C++单例设计模式
来源:互联网 发布:淘宝怎么看我的退货率 编辑:程序博客网 时间:2024/05/17 04:52
#include <iostream>
using namespace std;
class Engine
{
public:
static Engine* getInstance();
void showMe();
private:
Engine(){};
Engine(constEngine &t);
Engine& operator=(constEngine &t);
static Engine *m_engine;
};
Engine*Engine::m_engine = NULL;
Engine*Engine::getInstance()
{
if (NULL ==m_engine) {
m_engine = newEngine();
}
returnm_engine;
}
voidEngine::showMe()
{
cout <<"I am a singleton class of engine!" << endl;
}
int main()
{
auto engine = Engine::getInstance();
engine->showMe();
return 0;
}
0 0
- (C#)设计模式 之 单例模式
- 设计模式--单例模式 C++实现
- 设计模式之单例模式(C++)
- 设计模式(C++) -----单例模式
- 【设计模式C++】单例模式
- 单例设计模式(C#) 简单模式
- 单例设计模式(C#) 懒汉模式
- C#--设计模式之单例模式
- 单例模式的设计(C++)
- Objective-C 设计模式之单例
- Objective-c中的单例设计模式
- 设计模式,objective-c单例
- Objective-c ;单例设计模式
- Objective-c 单例设计模式
- objective c单例设计模式
- Objective-c 单例设计模式
- Objective-C之单例设计模式
- Objective-c 实现单例设计模式
- Android刷机 概念整理
- 网络投票中的作弊与反作弊
- WCF服务生成客户端的配置文件步骤
- 1035. 插入与归并
- qgy 的ios 一些小经验,小技巧
- C++单例设计模式
- 屏幕模式
- 【图解】Linux下C程序进程地址空间布局
- 模仿qq空间评论以及回复
- uinty
- Linux常用命令
- java面试题
- nyoj-171 聪明的kk
- 【剑指Offer面试编程题】题目1388:跳台阶--九度OJ