设计模式——外观模式(C++实现)

设计模式——外观模式(C++实现)

设计模式——外观模式(C++实现)

 #include <string>
#include <iostream> using namespace std; class STSystemA
{
public:
void OperationA()
{
cout<< "System A Operation....."<< endl;
}
}; class STSystemB
{
public:
void OperationB()
{
cout<< "System B Operation....."<< endl;
}
}; class STSystemC
{
public:
void OperationC()
{
cout<< "System C Operation....."<< endl;
}
}; class STFacade
{
public:
STFacade()
{
m_stSystemA = new STSystemA();
m_stSystemB = new STSystemB();
m_stSystemC = new STSystemC();
} virtual ~STFacade()
{
delete m_stSystemA;
delete m_stSystemB;
delete m_stSystemC;
} void Operation()
{
m_stSystemA->OperationA();
m_stSystemB->OperationB();
m_stSystemC->OperationC();
} STSystemA* m_stSystemA;
STSystemB* m_stSystemB;
STSystemC* m_stSystemC; }; int main(int argc, char* argv[])
{
STFacade* stFacade = new STFacade();
stFacade->Operation(); delete stFacade; return ;
}
/////////////////////////////////////
[root@ ~/learn_code/design_pattern/11_facade]$ ./facade
System A Operation.....
System B Operation.....
System C Operation.....
上一篇:fullcalendar日历控件集合知识


下一篇:idea 修改单个文件的 编码格式