class SubSystemOne
{
public void MethodOne()
{
System.out.println(1);
}
}
class SubSystemTwo
{
public void MethodTwo()
{
System.out.println(2);
}
}
class SubSystemThree
{
public void MethodThree()
{
System.out.println(3);
}
}
class SubSystemFour
{
public void MethodFour()
{
System.out.println(4);
}
}
public class facade {
SubSystemOne one;
SubSystemTwo two;
SubSystemThree three;
SubSystemFour four;
public facade()
{
one = new SubSystemOne();
two = new SubSystemTwo();
three = new SubSystemThree();
four = new SubSystemFour();
}
public void MethodA()
{
System.out.println("1111111");
one.MethodOne();
two.MethodTwo();
four.MethodFour();
}
public void MethodB()
{
System.out.println("22222222222");
two.MethodTwo();
three.MethodThree();
four.MethodFour();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
facade f = new facade();
f.MethodA();
f.MethodB();
}
}
外观模式
最新推荐文章于 2024-08-05 11:05:13 发布