我有一些麻烦。
我做了一些接口(c++ 中的抽象类)。在我的类中实现它(也从 CCObject 派生)。在第三堂课中,我尝试调用接口的方法并获得 SIGABORT。这里的代码
//interface class
class CallBackInterface
{
public:
virtual void SomeMethod() = 0;
};
//my class that implement the interface
class MyClass : public CallBackInterface, public CCObject
{
public:
void SomeMethod(){/*some realization*/};
};
//class that invoke the SomeMethod
class CallBacker()
{
public:
CallBackInterface* callBackObject;
};
//main code
CallBacker* callBacker = new CallBacker();
MyClass* myClass = new MyClass();
callBacker->callBackObject = myClass;
/*
this string generate unexpected invoke of copyWithZone method CCObject's class
with SIGABORT. */
callBacker->callBackObject->SomeMethod();
/*
In debugger mode I see that SomeMethod don't invoke (debugger don't go into it). Here the copyWithZone*/
CCObject* CCCopying::copyWithZone(CCZone *pZone)
{
CC_UNUSED_PARAM(pZone);
CCAssert(0, "not implement"); <<- here is SIGABORT
return 0;
}
调用使copyWithZone
我的应用程序崩溃