![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
文章平均质量分 92
低头看天,抬头走路
句句都是正确的废话,招招都是致命的空招。
展开
-
c++实现单例模式
懒汉:class single{ private: single() {} static single* s; public: get_instance();};single* single::s == NULL;single* single::get_instance(){ if (s == NULL) { ...原创 2020-03-11 19:07:21 · 184 阅读 · 0 评论 -
单例模式,工厂模式,代理模式汇总
1.单例模式: 饿汉式 (可用) public class Demo{ private static Demo demo = new Demo(); private Demo(){ } public static Demo getInstance(){ return demo; } } 懒汉式双锁(不可用) public class Demo{ privat原创 2016-05-03 16:17:18 · 7114 阅读 · 0 评论