大话数据结构 外观模式
2013-05-01 15:39
381 查看
package org.ustc.facade; public class Fund { private NationDebt dn; private Realty realty; private Stock stock; public Fund() { dn = new NationDebt(); realty = new Realty(); stock = new Stock(); } public void buy(){ dn.buy(); realty.buy(); stock.buy(); } public void sell(){ dn.sell(); realty.sell(); stock.sell(); } }
package org.ustc.facade; public class NationDebt { public void buy(){ System.out.println("购买国债"); } public void sell(){ System.out.println("卖出国债"); } }
package org.ustc.facade; public class Realty { public void buy(){ System.out.println("购买了房地产"); } public void sell(){ System.out.println("卖出房产"); } }
package org.ustc.facade; public class Stock { public void buy(){ System.out.println("购买股票"); } public void sell(){ System.out.println("卖出股票"); } }
package org.ustc.facade; public class Main { public static void main(String[] args) { Fund fund = new Fund(); fund.buy(); fund.sell(); } }
相关文章推荐
- vb.net版机房收费系统——教你七层架构(三)—外观模式
- PHP之外观模式
- 设计模式之外观模式(Facade)
- Java实现设计模式之外观模式
- Net设计模式实例之外观模式(Façade Pattern)
- 设计模式 外观模式
- Head First设计模式笔记(外观模式)
- (第Ⅲ部分 结构型模式篇) 第11章 外观模式(Façade Pattern)
- Facade外观模式
- 极速理解设计模式系列:13.外观模式(Facade Pattern)
- 设计模式之python版(八)--外观模式
- 【设计模式】【八】外观模式
- 外观模式
- 设计模式之外观模式
- 设计模式-结构型模式-外观
- 设计模式 外观模式 一键电影模式
- android应用开发设计模式之外观模式
- 设计模式C++实现(7)——外观模式、组合模式
- 2009-05-10读书记录:《head first设计模式》第七章——适配器模式与外观模式
- Facade外观模式