标签:rac contract rgs pen 外观 imp print com rri
public interface Bank { void lend(); } class WuHanBank implements Bank{ @Override public void lend() { System.out.println("银行借钱"); } }
public interface KFS { void signContract(); } class Wanke implements KFS{ @Override public void signContract() { System.out.println("跟开发商签合同"); } }
/** * 买房流程的外观对象 * @author bzhx * 2017年3月13日 */ public class BuyHouseFacade { public void buyHouse(){ Bank b = new WuHanBank(); b.lend(); KFS k = new Wanke(); k.signContract(); } }
public class Client { public static void main(String[] args) { // Bank b = new WuHanBank(); // b.lend(); // KFS k = new Wanke(); // k.signContract(); //外观模式写法 new BuyHouseFacade().buyHouse(); } }
标签:rac contract rgs pen 外观 imp print com rri
原文地址:http://www.cnblogs.com/qingdaofu/p/7473213.html