基类:CApplicationProtocol
纯虚函数virtual bool applicationDidFinishLaunching() = 0;
CCApplication继承于CCApplicationProtoco:
int run();//调用applicationDidFinishLaunching();
static CCApplication* sharedApplication(); //返回sm_pSharedApplication
static CCApplication* sm_pSharedApplication;//构造函数在构造时 sm_pSharedApplication=this,即在自类调用父类的构造函数时,把子类的this给父类,在父类调用run函数时,调用的是自类已经实现的applicationDidFinishLaunching();这是代理模式
AppDelegate继承于CCApplication 实现纯虚函数applicationDidFinishLaunching();
main:
AppDelegate app;
return CCApplication::sharedApplication()->run();