I am curious if I am misunderstanding something here. I cant figure out why the setup below is bombing out and giving me memory access violations.
I have 2 classes (please forgive any syntax errors as this is only a code mockup).
class A : public CCSprite
{
public:
A();
void initSelf();
SCENE_NODE_FUNC(A);
};
A::A()
{
}
void A::initSelf()
{
CCSprite::initWithSpriteFrameName("a preloaded frame name");
}
//////////////////////////////////////////////////////////
class B : public A
{
public:
B();
void initSelf();
SCENE_NODE_FUNC(B);
};
B::B()
{
}
void B::initSelf()
{
this->A::initSelf();
}
//////////////////////////////////////////////////////////
/* Inside of a CCLayer */
B* someB = B::node();
someB->initSelf();
this->addChild(someB);
someB->removeFromParentAndCleanup(true); //Causes fault!
(OR)
this->removeChild(someB, true); //Wont fault, however the parent tells me that it does not contain this child
This is obviously not my entire code path, but I believe it is the portion that is faulting. If there is no reason for that to be happening, please let me know I and will continue to tear apart the rest of the class to determine if it is going awry somewhere else. However, I have a feeling this is happening because of the way SCENE_NODE_FUNC works? Is inheriting from a CCSprite, and then inheriting from that class, a bad practice, or am I missing something? Thanks in advance.