随笔分类 -  设计模式

常用网站
摘要:设计模式 https://design-patterns.readthedocs.io/zh_CN/latest/structural_patterns/adapter.html 23种设计模式 https://design-patterns.readthedocs.io/zh_CN/latest/ 阅读全文
posted @ 2024-01-27 01:27 蜀山菜鸟 阅读(20) 评论(0) 推荐(0)
适配器,桥接,代理,享元模式示例代码
摘要:适配器模式: // 适配器模式 将一个类的接口转换成客户希望的另外一个接口 // 接口层 class OutInterface { public: virtual ~OutInterface() = default; // 客户希望实现的接口 例如: 用户希望一次性打印姓名 年龄 成绩 virtua 阅读全文
posted @ 2022-05-19 14:57 蜀山菜鸟 阅读(53) 评论(0) 推荐(0)
代理模式
摘要:class Service { public: int QueryData() { // 服务端,查询数据,订阅数据,修改数据等 cout << "this is service data" << endl; return 0; } }; class CProxy { private: CProxy 阅读全文
posted @ 2022-05-16 21:35 蜀山菜鸟 阅读(29) 评论(0) 推荐(0)