设计模式——适配器模式(Adapter)
来源:互联网 发布:怎样在电脑上编程软件 编辑:程序博客网 时间:2024/05/22 01:25
将两个不兼容的类纠合在一起使用,属于结构型模式,需要有Adaptee(被适配者)和Adaptor(适配器)两个身份.实现Adapter 有两种方式:组合(composition)和继承(inheritance)。
类适配器:
类适配器是通过继承类适配者类(Adaptee Class)实现的,另外类适配器实现客户类所需要的接口。当客户对象调用适配器类方法的时候,适配器内部调用它所继承的适配者的方法。
对象适配器:
对象适配器包含一个适配器者的引用(reference),与类适配器相同,对象适配器也实现了客户类需要的接口。当客户对象调用对象适配器的方法的时候,对象适配器调它所包含的适配器者实例的适当方法。
- 设计模式——适配器模式(Adapter)
- 设计模式——适配器模式(Adapter)
- 【设计模式】—— 适配器模式Adapter
- 设计模式—ADAPTER 适配器模式
- 设计模式——适配器模式(Adapter)
- java设计模式——适配器模式(Adapter)
- java设计模式6——适配器模式(Adapter)
- 设计模式——适配器模式(Adapter)
- 设计模式——适配器模式(Adapter Pattern)
- 设计模式——适配器模式(Adapter)
- 设计模式——适配器模式(Adapter Pattern)
- 设计模式(6)——适配器模式(Adapter)
- 设计模式(7)——适配器模式(Adapter Pattern)
- 设计模式 —— 适配器模式(Adapter Pattern)
- Java设计模式——适配器模式(Adapter Pattern)
- 【四】设计模式——适配器模式(Adapter Pattern)
- 设计模式——适配器模式(Adapter)
- 设计模式——适配器模式(Adapter Pattern)
- 21 Important FAQ questions for WPF and SilverLight
- 中国创业者的20:80法则
- SQL 脚本一
- 算式猜数字
- Linux常用命令
- 设计模式——适配器模式(Adapter)
- 冬瓜连锅汤
- 内存分配 malloc()和calloc()
- 习惯
- linux下的JDK Eclipse安装
- “黑客”和“驴”[PS:貌似是农夫牛写地]
- 在Ubuntu下安装JDK 6和Eclipse
- spring2.x bean的五个作用域
- 别把感情太当回事