I’m not quite understand about the release and retain when use member variables.
For example:
class A : public CCLayer
{
public:
A ();
virtual ~A();
CREATE_FUNC(A);
virtual bool init();
protected:
CCString *mStr;
};
A::A ()
{
mStr=NULL;
}
bool A::init()
{
bool bRet=false;
while(0)
{
CC_BREAK_IF(CCLayer::init());
mStr=CCString::create(“abc”);
mStr->retain();
bRet=true;
}
return bRet;
}
Now I have the question that do I need to call “mStr->release()” int the A\ function?
In\ fact\ I\ have\ tried\ runing\ the\ program\ without\ calling\ the\ “mStr->release()”\ int\ theA function and got no errors.
I don’t know whether this is right,could somebody please help me?