博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年12月29日

摘要: 定义:单件模式确保一个类只有一个实例,并提供一个全局访问点实现一:#include <iostream>using namespace std;class CSingleton{public: static CSingleton* getInstance(); static void cleanInstance(); int getValue(); void setValue(int iValue);private: int m_iValue; static CSingleton* m_pSingleton; CSingleton(); ~CSi... 阅读全文

posted @ 2011-12-29 22:55 开源云 阅读(4127) 评论(0) 推荐(0)