design mode
NeDong
这个作者很懒,什么都没留下…
展开
-
中介者模式
定义 中介者模式(mediator),使用一个中介对象来封装一系列的对象交互。中介者使各对象不需要显式地相互调用,从而使其耦合松散,而且可以独立地改变他们之间的交互。 代码例子 #include #include using namespace std; class medium; class person { public: person(){} virtual ~person原创 2016-02-26 23:46:01 · 327 阅读 · 0 评论 -
简单工厂模式
#include #include using namespace std; enum EProductType { TypeA, TypeB, TypeC, }; class Product { public: virtual void Show() = 0; }; class ProductA : public Product { public: void Show()原创 2016-02-27 10:51:50 · 267 阅读 · 0 评论