国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 通山县| 屏山县| 古丈县| 郓城县| 上思县| 衡阳市| 滕州市| 永年县| 揭阳市| 通辽市| 宜丰县| 盐津县| 平山县| 台湾省| 仲巴县| 深泽县| 龙陵县| 密山市| 常山县| 乐都县| 武鸣县| 黔东| 茶陵县| 二连浩特市| 宝丰县| 于都县| 简阳市| 教育| 肥城市| 团风县| 璧山县| 丹棱县| 麦盖提县| 舞阳县| 乐陵市| 仁布县| 嘉义县| 永济市| 防城港市| 临桂县| 秭归县|