国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

c++單例模式實現源碼

2019-11-14 09:16:00
字體:
來源:轉載
供稿:網友
#define _CRT_SECURE_NO_WARNINGS#include <iostream>using namespace std;class Instance{PRivate:	Instance(){}	/*私有化復制構造函數*/	Instance(const Instance&){}	/*私有化=操作符*/	Instance& Operator=(const Instance&){}public:	static Instance *getInstance()	{		return Singleton;	}public:	static Instance *Singleton;};/*初始化*/Instance *Instance::Singleton = new Instance;/*測試*/void test(){	Instance *p1 = Instance::getInstance();	Instance *p2 = Instance::getInstance();	if (p1 == p2)	{		cout << "p1 = p2" << endl;	}	else	{		cout << "p1 != p2" << endl;	}}int main() {	test();	system("pause");	return EXIT_SUCCESS;}
上一篇:C# 按鈕和標簽

下一篇:0014 異常處理

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临夏县| 麟游县| 海盐县| 井冈山市| 汉阴县| 凭祥市| 临清市| 西峡县| 东城区| 新闻| 聊城市| 马尔康县| 临西县| 正安县| 建宁县| 乌拉特后旗| 广汉市| 瑞昌市| 天祝| 都江堰市| 屯门区| 麻栗坡县| 宁南县| 五大连池市| 东至县| 桐梓县| 贵南县| 大丰市| 凭祥市| 仪陇县| 中江县| 龙门县| 雷波县| 泰顺县| 阳高县| 台江县| 灌云县| 临武县| 肥乡县| 红安县| 西宁市|