Search code examples
c++ioscocos2d-x

'shared application' is private member of "cocos2d::ccapplication"


am using cocos2dx 2.2

i got this error 'shared application' is private member of "cocos2d::ccapplication" when acessing appdelegate class variables.

my code for access appdelegate :-

  AppDelegate*  appdel = (AppDelegate*)AppDelegate::sharedApplication();

below variable in CCApplication.h is in public property.

static CCApplication* sharedApplication();

little confused where am doing wrong ?


Solution

  • Change your AppDelegate Class Code like this..

    class  AppDelegate : public cocos2d::CCApplication
    

    From

    class  AppDelegate : private cocos2d::CCApplication
    

    Your CCaplication is Private property. u need to change that to public.