AI State Interface
template <class entity_type>
class IAIState
{
public:
virtual ~IAIState(){}
virtual void enter( entity_type* ) = 0;
virtual void execute( entity_type* ) = 0;
virtual void exit( entity_type* ) = 0;
};
AI State implementing Interface
class AIStateWander : public IAIState<Animal>
{
public:
AIStateWander(){}
virtual ~AIStateWander();
AIStateWander( const AIStateWander& );
AIStateWander& operator=( const AIStateWander& );
void enter( Animal* animal );
void execute( Animal* animal );
void exit( Animal* animal );
};
Animal header for reference
class Animal : public BaseObject
{
public:
Animal( SDL_Surface* img, float posX, float posY );
virtual ~Animal();
virtual void update( int width, int height );
virtual void draw( SDL_Surface* src, const Camera& cam );
virtual void clean();
AIStateMachine<Animal>* getFSM() { return m_pAIStateMachine; }
private:
AIStateMachine<Animal>* m_pAIStateMachine;
};
Now I'm getting an error on the declaration of my constructor of the AIWanderState
Error = "undefined reference to vtable for AIWanderState"
I know the vtable is created from my BaseObject class, and my Animal class overrides it. I've also got another vtable from my IAIState class, and my AIWanderState overrides the virtual functions there. Now my question is, does the templated base class that AIStateWander is inheriting from cause confusion with the vtables?

New Topic/Question
Reply



MultiQuote




|