In Cocos2d-x 2.1.5 I used to subclass CCActionInterval and call a constructor as:
CCWiggle* CCWiggle::create(float duration, float amount)
{
CCWiggle *pRet = new CCWiggle();
if (pRet && pRet->initWithDuration(duration, amount))
{
pRet->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
}
return pRet;
}
Now in V3 I get an error: Allocating an object of abstract class type ‘CCWiggle’
Now I think this is because ActionInterval has virtual functions = 0. When I look in ‘CCActionInterval.h’ I see:
//
// Overrides
//
virtual bool isDone(void) const override;
virtual void step(float dt) override;
virtual void startWithTarget(Node *target) override;
virtual ActionInterval* reverse() const override = 0;
virtual ActionInterval *clone() const override = 0;
What I dont understand is which ones of these I need to override? All of them? I already override ‘startWithTarget’
How do I do this? I thought that adding:
virtual bool isDone(void) const override;
virtual void step(float dt) override;
virtual void startWithTarget(Node *target) override;
virtual ActionInterval* reverse() const override = 0;
virtual ActionInterval *clone() const override = 0;
to my header and:
bool CCWiggle::isDone(void) {}
void CCWiggle::step(float dt) {}
cocos2d::ActionInterval* CCWiggle::reverse();
cocos2d::ActionInterval* CCWiggle::clone();
to my .cpp would be enough? but I still get some out of line definitions, so I still misunderstand something.