首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

单件形式的基类,C++

2013-02-04 
单件模式的基类,C++看《游戏编程精粹1》中间有一段代码void TestFunc1() { TextureMgrtMgr Texture *pTexSt

单件模式的基类,C++

看《游戏编程精粹1》中间有一段代码

void TestFunc1() { TextureMgrtMgr; Texture *pTexStone = g_TextureMgr.GetTexture("stone"); } void TestFunc2() { Ston *pSingleton = Ston::CreatePtr(); if (pSingleton) { delete pSingleton; pSingleton = NULL; } }    int _tmain(int argc, _TCHAR* argv[]) {  int a = (int)(int*)1; int b = (int)(double*)1;  TestFunc1();  TestFunc2();   Texture *pTexStone = g_TextureMgr.GetTexture("stone"); return 0; }

当然在Texture *pTex.....一句会有一个断言提示。因为对象已经被销毁了嘛

热点排行