摘要: #1. 适配器模式 #include <iostream> using namespace std; class ThreePhasePlug { public: void doThreePhasePlug() { cout << "three phase" << endl; } }; class 阅读全文
posted @ 2023-02-25 09:47 XCode-01 阅读(53) 评论(0) 推荐(0)
摘要: IocContainer.h #pragma once #include<map> #include<string> #include<functional> #include<memory> #include<stdexcept> template<class T> class IocContai 阅读全文
posted @ 2023-02-19 14:59 XCode-01 阅读(57) 评论(0) 推荐(0)
摘要: api.h #pragma once #include<string> #include<iostream> class API { public: virtual void run(std::string) = 0; protected: API() {}; }; class BAPI : pub 阅读全文
posted @ 2023-02-19 14:23 XCode-01 阅读(18) 评论(0) 推荐(0)
摘要: 业务场景 未使用建造者模式实现 #include<iostream> #include<string> #include<vector> #include<sstream> using namespace std; template<class T> string ConvertToString(T 阅读全文
posted @ 2023-02-19 14:17 XCode-01 阅读(14) 评论(0) 推荐(0)
摘要: 原型模式(Prototype Pattern): 使用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。原型模式是一种对象创建型模式 应用实例 描述如下: 未使用原型模式 #include<iostream> #include<string> #include<sstream> usin 阅读全文
posted @ 2023-02-19 14:10 XCode-01 阅读(16) 评论(0) 推荐(0)