这么简单的家伙也是设计模式之一?
我的理解就是多了一层封装的接口而已。
可能是我的理解不够透彻,或者说我理解有误。
我的理解就是多了一层封装的接口而已。
可能是我的理解不够透彻,或者说我理解有误。
#include <iostream>
#include <conio.h>
class SubSystemOne
{
public:
void work()
{
printf("one is work\r\n");
}
};
class SubSystemTwo
{
public:
void work()
{
printf("two is work\r\n");
}
};
class SubSystemThree
{
public:
void work()
{
printf("three is work\r\n");
}
};
class SubSystemFour
{
public:
void work()
{
printf("four is work\r\n");
}
};
class Facade
{
private:
SubSystemOne m_One;
SubSystemTwo m_Two;
SubSystemThree m_Three;
SubSystemFour m_Four;
public:
void MethodA()
{
printf("Method A\r\n");
m_One.work();
m_Four.work();
}
void MethodB()
{
printf("Method B\r\n");
m_Two.work();
m_Three.work();
}
};
int main()
{
Facade f;
f.MethodA();
f.MethodB();
getch();
return 0;
}