I am trying to change my component pool generator to use a variadic templates in an attempt to avoid all the Init() functions and use each component constructor instead. However i cant get it to compile.
This is the component pool class: it has a base class and its methods will be overriden by the parent class:
class iComponentPool
{
public:
virtual iComponent* Create(EntityId entityId) = 0;
virtual iComponent* Get(EntityId entityId) = 0;
virtual void Destroy(EntityId entityId) = 0;
};
template<typename T>
class componentIterator
{
public:
typename std::vector<T>::iterator beginIT;
typename std::vector<T>::iterator endIT;
};
template<typename T, typename ... Targs>
class componentPool : public iComponentPool, public componentIterator<T>
{
public:
T* Create(EntityId entityID, Targs... Args) override
{
};
T* Get(EntityId entityId) override
{
return nullptr;
};
void Destroy(EntityId entityId) override
{
};
};
However the compiler complains (and rightfully so) that the componentPool Create method is not overriding the base class method. Is there any way to get around this problem?
The actual error (VS 2015) is: ECS::componentPool::Create': method with override specifier 'override' did not override any base class methods.
Aucun commentaire:
Enregistrer un commentaire