设计模式-门面模式

 

public class System1 {
public void dosomething() {
System.out.println("system1..");
}
}

public class System2 {
public void dosomething() {
System.out.println("system2..");
}
}

public class Facade {
System1 system1 = new System1();
System2 system2 = new System2();
public void dosomething() {
system1.dosomething();
system2.dosomething();
}
}

public class Client1 {
public static void main(String[] args) {
Client1 client1 = new Client1();
client1.dosomething();
}

public void dosomething() {
Facade facade = new Facade();
facade.dosomething();
}
}

public class Client2 {
public static void main(String[] args) {
Client2 client2 = new Client2();
client2.dosomething();
}

public void dosomething() {
Facade facade = new Facade();
facade.dosomething();
}
}
posted @ 2022-02-24 23:00  剑阁丶神灯  阅读(15)  评论(0编辑  收藏  举报