本文共 1024 字,大约阅读时间需要 3 分钟。
目录
class SystemA{public: void doThing() { cout << "systemA do...." << endl; }};class SystemB{public: void doThing() { cout << "systemA do...." << endl; }};class SystemC{public: void doThing() { cout << "systemA do...." << endl; }};class Facade{public: Facade() { a = new SystemA; b = new SystemB; c = new SystemC; } ~Facade() { delete a; delete b; delete c; } void doThing() { a->doThing(); b->doThing(); c->doThing(); }protected:private: SystemA *a; SystemB *b; SystemC *c;};void main1414(){ /* SystemA *a = new SystemA; SystemB *b = new SystemB; SystemC *c = new SystemC; a->doThing(); b->doThing(); c->doThing(); delete a; delete b; delete c; */ Facade *f = new Facade; f->doThing(); delete f; cout<<"hello..."<<endl; system("pause"); return ;}
【注】参考传智扫地僧C++设计模式
转载地址:http://rxur.baihongyu.com/