How to use the method "CCApplication::sharedApplication()"?

How to use the method "CCApplication::sharedApplication()"?
0.0 0


I need to get the value of an element which is in the class“AppDelegate”, so I write the following code in the class“Controller”.But an error(in the following picture attached) happens at the end of the method.Please tell me in other classes how to use an element of the class“AppDelegate”. Thank you!

AppDelegate tempDelegate = (AppDelegate&)CCApplication::sharedApplication(); if (tempDelegate.currentGameData) { //... }

error.jpg (39.5 KB)


Just change
@ AppDelegate tempDelegate = …@
@ AppDelegate& tempDelegate = … @ :wink:


Really it is! I’m so stupid. Thank you very much!