摘要: #include <iostream> #include <memory> class ConcreteComponent1; class ConcreteComponent2; class Visitor { public: virtual void visitconcretecomponent1 阅读全文
posted @ 2022-02-25 18:18 南乡水 阅读(21) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class AbstractClass { public: void show() { op1(); op2(); op3(); hook(); } protected: void op1() { std::cout << 阅读全文
posted @ 2022-02-25 18:18 南乡水 阅读(8) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Strategy { public: virtual void show() = 0; }; class Context { public: void setStrategy(std::shared_ptr<St 阅读全文
posted @ 2022-02-25 18:16 南乡水 阅读(15) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <list> #include <memory> class AbstractObserver { public: virtual void update(std::string msg) = 0; }; class AbstractSubj 阅读全文
posted @ 2022-02-25 18:15 南乡水 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Context; class State { public: virtual void handle1(Context *c) = 0; virtual void handle2(Context *c) = 0; 阅读全文
posted @ 2022-02-25 18:15 南乡水 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> #include <vector> class Momento { public: Momento(std::string state) { this->state_ = state; } std::string state 阅读全文
posted @ 2022-02-25 18:14 南乡水 阅读(24) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Mediator { public: virtual void Notify(std::string Msg) = 0; }; class BaseComponent { public: virtual void 阅读全文
posted @ 2022-02-25 18:13 南乡水 阅读(19) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> #include <vector> template <typename T, typename U> class Iterator { public: virtual U cur() = 0; virtual void n 阅读全文
posted @ 2022-02-25 18:02 南乡水 阅读(13) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Reciever { public: void op1() { std::cout << "In Reciever op1()." << std::endl; } void op2() { std::cout < 阅读全文
posted @ 2022-02-25 17:59 南乡水 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Handler { public: virtual void handle(int data) = 0; virtual void setNextHandler(std::shared_ptr<Handler> 阅读全文
posted @ 2022-02-25 17:58 南乡水 阅读(28) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Subject { public: virtual void show() = 0; }; class RealSubject : public Subject { public: void show() ove 阅读全文
posted @ 2022-02-25 17:54 南乡水 阅读(12) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> #include <unordered_map> class Flyweight { public: Flyweight(int data) : data_(data) {} void show() { std::cout 阅读全文
posted @ 2022-02-25 17:52 南乡水 阅读(11) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class SubsystemA { public: void show() { std::cout << "In SubsystemA show()." << std::endl; } }; class Subsystem 阅读全文
posted @ 2022-02-25 17:51 南乡水 阅读(11) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Component { public: virtual void show() = 0; }; class ConcreteComponent : public Component { public: void 阅读全文
posted @ 2022-02-25 17:50 南乡水 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Implementation { public: virtual void show() = 0; }; class ConcreteImplementation1 : public Implementation 阅读全文
posted @ 2022-02-25 17:49 南乡水 阅读(11) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <list> #include <memory> class Component { public: virtual void show() const = 0; virtual void add(const std::shared_ptr< 阅读全文
posted @ 2022-02-25 17:49 南乡水 阅读(20) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Adaptee { public: void concreteShow() { std::cout << "In Adaptee concreteShow()." << std::endl; } }; class 阅读全文
posted @ 2022-02-25 17:48 南乡水 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Singleton { public: Singleton(const Singleton&) = delete; Singleton& operator = (const Singleton&) = delete; static Singleto 阅读全文
posted @ 2022-02-25 17:47 南乡水 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include <memory> #include <iostream> class Prototype { public: Prototype() {} Prototype(const Prototype& p) { this->data = p.data; } virtual std::uni 阅读全文
posted @ 2022-02-25 17:46 南乡水 阅读(12) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <memory> class Product { public: void setPartA(int partA) { this->partA = partA; } void setPartB(int partB) { this->partB 阅读全文
posted @ 2022-02-25 17:45 南乡水 阅读(21) 评论(0) 推荐(0) 编辑