newwy
奋斗在IT路上的小蜗牛。一步一步往上爬,爬到小牛,在到大牛,然后是神牛,然后是犇,然后就可以离开IT行业,回归大自然了。 远离IT,珍爱生命!!! 记录学习的点滴。
/*********************************
*设计模式--外观模式实现
*C++语言
*Author:WangYong
*Blog:http://www.cnblogs.com/newwy
********************************/
#include <iostream>
using namespace std;
class Subsystem1
{
	public:
	Subsystem1(){}
	~Subsystem1(){}
	void Operation(){cout<<"Subsystem1 Operation..."<<endl;}
};
class Subsystem2
{
	public:
	Subsystem2(){}
	~Subsystem2(){}
	void Operation(){cout<<"Subsystem2 Operation..."<<endl;}
};
class Facade
{
	public:
	Facade(){this->_subs1 = new Subsystem1();this->_subs2 = new Subsystem2();}
	~Facade(){delete _subs1;delete _subs1;}
	void OperationWrapper(){this->_subs1->Operation();this->_subs2->Operation();}
	private:
	Subsystem1 *_subs1;
	Subsystem2 *_subs2;
};
int main()
{
	Facade *f = new Facade();
	f->OperationWrapper();
	return 0;
}

posted on 2010-10-18 23:53  newwy  阅读(577)  评论(0编辑  收藏  举报