c++ 设计模式之 外观模式
来源:互联网 发布:java socket 连接超时 编辑:程序博客网 时间:2024/06/01 17:49
概念
为一系列子系统提供一个统一的接口.外关模式一个高层次的接口使子系统更加容易的使用.
类图
示例代码
#include <iostream>// Subsystem 1class SubSystemOne{public:void MethodOne(){ std::cout << "SubSystem 1" << std::endl; };};// Subsystem 2class SubSystemTwo{public:void MethodTwo(){ std::cout << "SubSystem 2" << std::endl; };};// Subsystem 3 class SubSystemThree{public:void MethodThree(){ std::cout << "SubSystem 3" << std::endl; }};// Facadeclass Facade{public:Facade(){pOne = new SubSystemOne();pTwo = new SubSystemTwo();pThree = new SubSystemThree();}void MethodA(){std::cout << "Facade::MethodA" << std::endl;pOne->MethodOne();pTwo->MethodTwo();}void MethodB(){std::cout << "Facade::MethodB" << std::endl;pTwo->MethodTwo();pThree->MethodThree();}private:SubSystemOne *pOne;SubSystemTwo *pTwo;SubSystemThree *pThree;};int main(){Facade *pFacade = new Facade();pFacade->MethodA();pFacade->MethodB();return 0;}
- C#--设计模式之外观模式
- 设计模式之外观
- 设计模式之外观
- 设计模式 之 外观
- 设计模式之外观
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- 设计模式之外观模式
- GridView控件的编辑、删除、更新、取消!
- 如何批量编译连接程序?
- javaweb的xml的一些讲解
- 错误: 初始值设定项里有未知的字段‘ioctl’
- tomcat中使用连接池
- c++ 设计模式之 外观模式
- 黑马程序员——1+...+100的累加不同的实现方法
- 浙大ACM 1311题目翻译和答案
- 堆栈
- 使用MapX的基石,在VC下显示gst格式的地图
- linux最常用的5条命令
- android中AlertDialog的使用方法
- 百度文库中在线阅读器的基本思想
- VC中MapX的开发