设计模式之Facade——家庭篇
1、 在这里,先定义家庭的各个成员类:
妻子(Wife):
public class Wife {
protected Wife() {
System.out.println("老婆伟大 !");
}
}
女儿(Daughter):
public class Daughter {
protected Daughter () {
System.out.println("女儿可爱 !");
}
}
我(Me):
public class Me {
protected Me() {
System.out.println("我爱我家 !");
}
}
2、定义家庭对外展现(FamilyOutShow)类:
public class FamilyOutShow {
public void MyFamily() {
Wife myWife = new Wife(); //我的老婆
Daughter myDaughter = new Daughter (); //我的女儿
Me me= new Me(); //我自己
}
}
3、编写测试类:
补充:Web开发 , ASP.Net ,