外观模式:为子系统中的一组接口提供一个一致的界面,此模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。
外观模式(Facede)结构图:

四个子系统的类:
class SubSystemOne
{
public:
void MethodOne()
{
cout<< “子系统方法一”< } }; class SubSystemTwo { public: void MethodTwo() { cout<< “子系统方法二”< } }; class SubSystemThree { public: void MethodThree() { cout<< “子系统方法三”< } }; class SubSystemFour { public: void MethodFour { cout<< “子系统方法四”< } }; 外观类: class Fa ade { private: SubSystemOne one; SubSystemTwo two; SubSystemThree three; SubSystemFour four; public: Fa ade() { one = new SubSystemOne(); two = new SubSystemTwo(); three = new SubSystemThree(); four= new SubSystemFour(); } void MethodA() { cout<< “方法组A”< one.MethodOne(); two.MethodTwo(); fout.MethodFour(); } void MethodB() { cout<< “方法组B”< two.MethodTwo(); three.MethodThree(); } }; 相关阅读: