设计模式之外观模式(Facade)
来源:互联网 发布:in my secret life知乎 编辑:程序博客网 时间:2024/06/13 22:06
优点:1)为复杂的子系统提供了简单接口
2)提高子系统的独立性
3)在层次结构中,可以使用Facade模式定义系统中每一层的接口
#include <iostream>using namespace std;//子系统class A{public: void run(){cout<<"run A"<<endl;}};class B{public: void run(){cout<<"run B"<<endl;}};class C{public: void run(){cout<<"run C"<<endl;}};//高层接口Facadeclass Facade{public: void run() { A a; a.run(); B b; b.run(); C c; c.run(); }};int main(){ Facade facade; facade.run(); return 0;}
运行结果:
run A
run B
run C
阅读全文
0 0
- 设计模式之Facade(外观)
- 设计模式之Facade(外观)
- 设计模式之Facade (外观)
- 设计模式之Facade模式(外观模式)
- 设计模式之Facade外观模式
- 设计模式之Facade(外观)模式
- 设计模式之外观(Facade)模式
- 设计模式学习之---Facade(外观)模式
- 设计模式之Facade-外观模式
- 设计模式之八、外观模式Facade
- 设计模式之(五)外观模式Facade
- 设计模式之外观模式(Facade)
- 设计模式之外观模式(Facade Pattern)
- 设计模式之九 --- 外观(Facade)模式
- 浅学设计模式之外观<Facade>模式
- 设计模式之外观模式 facade
- 设计模式之外观模式Facade
- 【设计模式】之外观模式(Facade)
- FTP、TFTP
- ==、equals、hashCode区别?
- Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.bui
- 关于Quazip解压中文乱码问题的解决
- 线程池? 如何设计一个动态大小的线程池,有哪些方法?
- 设计模式之外观模式(Facade)
- android cocos2d-x3.14 编译 boost 1_64_0
- 排序——冒泡排序
- js生成二维码(qrcode.js)
- TCP拥塞处理—Congestion Handing
- 编写高效的JavaScript程序
- 测试
- 计算机网络分层(OSI七层、 TCP/IP四层)
- Android聊天软件的开发