设计模式
century_sunshine
这个作者很懒,什么都没留下…
展开
-
使用全局变量设计单例模式
使用全局变量设计单例模式原创 2023-02-21 15:34:24 · 146 阅读 · 0 评论 -
设计模式之单例模式
/* 1.单例模式的类只提供私有的构造函数 2.类定义中含有一个该类的静态私有对象 3.该类提供了一个静态的公有的函数用于创建它本身的静态私有对象 */ class Singleton { public: static Singleton* GetInstance() { if(pInstance == nullptr)//懒加载,只有在使用时才生成 { pthread_mut...原创 2018-08-05 21:38:48 · 146 阅读 · 0 评论