![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
爱动漫的小明
这个作者很懒,什么都没留下…
展开
-
C++23种设计模式之工厂模式
//简单工厂模式,缺点当产品分类较多时,需要在工厂类中写太多的分类代码,显得冗余 #include <iostream> #include <string> using namespace std; enum Tank_Type { Tank_56, Tank_59 }; ///简单工厂模式 //抽象类 class Tank { public: virtual const string &type() = 0; virtual aut.原创 2021-04-21 12:29:46 · 140 阅读 · 0 评论 -
C++的23种设计模式之单例模式
///简单工厂模式 #include <iostream> using namespace std; enum Tank_Type { Tank_56, Tank_59 }; ///简单工厂模式 //抽象类 class Tank { public: virtual const string &type() = 0; }; //具体产品类 class Tank56:public Tank { public: Tank56():Tank(),m_T.原创 2021-04-19 18:58:03 · 96 阅读 · 0 评论