摘要: #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 南乡水 阅读(34) 评论(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 南乡水 阅读(22) 评论(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 南乡水 阅读(19) 评论(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 南乡水 阅读(19) 评论(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 南乡水 阅读(27) 评论(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 南乡水 阅读(27) 评论(0) 推荐(0)
摘要: #include <iostream> #include <memory> class Implementation { public: virtual void show() = 0; }; class ConcreteImplementation1 : public Implementation 阅读全文
posted @ 2022-02-25 17:49 南乡水 阅读(17) 评论(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 南乡水 阅读(24) 评论(0) 推荐(0)
摘要: #include <iostream> class Singleton { public: Singleton(const Singleton&) = delete; Singleton& operator = (const Singleton&) = delete; static Singleto 阅读全文
posted @ 2022-02-25 17:47 南乡水 阅读(9) 评论(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 南乡水 阅读(19) 评论(0) 推荐(0)