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

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

c++單例模式實(shí)現(xiàn)源碼

2019-11-14 09:50:14
字體:
供稿:網(wǎng)友
#define _CRT_SECURE_NO_WARNINGS#include <iostream>using namespace std;class Instance{PRivate:	Instance(){}	/*私有化復(fù)制構(gòu)造函數(shù)*/	Instance(const Instance&){}	/*私有化=操作符*/	Instance& Operator=(const Instance&){}public:	static Instance *getInstance()	{		return Singleton;	}public:	static Instance *Singleton;};/*初始化*/Instance *Instance::Singleton = new Instance;/*測(cè)試*/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;}
上一篇:單鏈表的合并

下一篇:Dijkstra

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 锡林郭勒盟| 甘孜县| 马山县| 潜江市| 建始县| 丹寨县| 英德市| 定州市| 兴和县| 县级市| 西平县| 永丰县| 贵定县| 葫芦岛市| 长乐市| 客服| 平塘县| 崇明县| 中西区| 襄城县| 肃南| 永新县| 怀集县| 轮台县| 弋阳县| 兴仁县| 太原市| 兴安县| 阳新县| 齐齐哈尔市| 洛隆县| 成都市| 阿拉善右旗| 临邑县| 平罗县| 江陵县| 吴川市| 西藏| 韶山市| 梁河县| 青龙|