Abstract classes. I am doing it wrong.
Ortonas (41)
Dec 18, 2012 at 12:02am UTC
header
1 2 3 4 5 6 7 8 9 10 11 12 13
class FSM
{
public :
FSM();
~FSM();
void Update();
std::vector<FSMState*> statesMap;
public :
FSMState *currentState;
};
cpp
1 2 3 4 5 6 7 8
//Constructor
FSM::FSM()
{
FSMState* attack = new AttackEnemy();
currentState = attack;
statesMap.push_back(attack);
}
So, the problem is that I cannot assinge attack state to current state. It says "FSMState * cannot be assinged to FSMState *" Although line 6 is just fine.
Also, for probably the same reason, i cannot push it either.
Any ideas what went wrong?
Last edited on Dec 18, 2012 at 12:03am UTC
Zhuge (2974)
Dec 18, 2012 at 12:19am UTC
Is AttackEnemy derived from FSMState? If not, there's your problem.
Ortonas (41)
Dec 18, 2012 at 12:28am UTC
Yes, it is derived.
Zhuge (2974)
Dec 18, 2012 at 2:21am UTC
Can I see the exact error message?
Topic archived. No new replies allowed.