上一页 1 2 3 4 5 6 ··· 21 下一页
摘要: 1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 //访问者模式:核心叫做双重分发:两个多态:accept,visit 6 7 class XiaoMi; 8 class HuaWei; 9 class Oppo 阅读全文
posted @ 2024-01-15 13:56 泽良_小涛 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <stdio.h> 5 using namespace std; 6 7 //抽象的表达式对象以及Context对象 8 //用于保存计算的中间结果以及当 阅读全文
posted @ 2024-01-12 10:17 泽良_小涛 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <string> 3 #include <map> //用户名,用户的下载 4 using namespace std; 5 6 class DownloadManager; 7 class DownState { 8 public: 阅读全文
posted @ 2024-01-03 11:48 泽良_小涛 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> using namespace std; class Colleague; class Mediator { public: //对象在自身改变的情况下,通知Mediator进行变更 //让我们Mediator这个总线,负责 阅读全文
posted @ 2023-12-26 16:04 泽良_小涛 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> using namespace std; class OriginalWord; class Memento { public: Memento(string strWord):m_strWord(strWord){} pr 阅读全文
posted @ 2023-12-25 14:49 泽良_小涛 阅读(2) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <sstream> using namespace std; template <class T> string MyConvertToString(T value) { stringstream ss; 阅读全文
posted @ 2023-12-22 14:21 泽良_小涛 阅读(2) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <vector> using namespace std; class Light { public: void on() { cout << "灯亮了" << endl; } void off() { cout << "灯灭了" << en 阅读全文
posted @ 2023-12-20 15:44 泽良_小涛 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 一、代码示例 1 #include <iostream> 2 #include <vector> 3 #include <string> 4 using namespace std; 5 6 ///抽象一个Subject主题 7 ///观察者 8 class Observer { 9 public: 阅读全文
posted @ 2023-12-13 16:18 泽良_小涛 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 using namespace std; 3 4 //设计思想:我们父类和子类就是一个扩展的关系?是不是合适 5 //里氏代换原则:子类对象就应该能完全替代父类的行为 6 //对于继承这样设计,特别小心,我们:组合大于继承 7 //把quack和fly 阅读全文
posted @ 2023-12-12 15:27 泽良_小涛 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 using namespace std; 3 4 //PC机,手机,平板 5 class MakeOrder { 6 public: 7 //virtual void startOrder() =0;第一版 8 //钩子函数的模板方法 9 virtua 阅读全文
posted @ 2023-12-11 14:15 泽良_小涛 阅读(3) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 21 下一页