/** * Created by OneCoder on 2014/11/24. */ public class HouseOwner implements ISellHouse { @Override public void sellHouse() { System.out.println("Sell my house.") ; } } /** * Created by OneCoder on 2014/11/24. */ public class HouseProxy implements ISellHouse { private ISellHouse seller; public HouseProxy(ISellHouse seller) { this.seller = seller ; } @Override public void sellHouse() { System.out.println("Proxy: Publish the information."); System. out.println("Proxy: Contact the buyer."); seller.sellHouse(); System. out.println("Proxy: Get commision."); } }
原文地址:乱学设计模式——代理模式, 感谢原作者分享。
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com