Adapter模式
来源:互联网 发布:杭州淘宝g20怎么办 编辑:程序博客网 时间:2024/06/06 07:39
Adapter模式又叫适配器模式,顾名思义,这个模式就是把一个不能用的东西“适配”成可以用的东西。
namespace DesignPatternConsoleApp{ public class Target { public virtual void DoSomethingForTarget() { //do something here Console.WriteLine("virtual"); } } public class Adaptee { public void DoSomethingForAdaptee() { //do something here Console.WriteLine("Adaptee"); } } public class Adapter : Target { private Adaptee adaptee = new Adaptee();//got a reference of adaptee public override void DoSomethingForTarget() { adaptee.DoSomethingForAdaptee();//here adapt the adaptee to the target exactly } }}
- Adapter 模式 - Object Adapter
- Adapter 模式 - Class Adapter
- Adapter 模式 - Object Adapter
- Adapter 模式 - Class Adapter
- Adapter模式
- Adapter模式
- Adapter模式
- Adapter模式
- adapter模式
- Adapter模式
- Adapter模式
- Adapter 模式
- Adapter模式
- adapter模式
- Adapter模式
- Adapter模式
- Adapter模式
- Adapter模式
- 不带头节点的双向循环链表的基本操作
- 诱多还是真底部?
- 第九篇 黑马程序员-集合
- 利用树实现霍夫曼编码
- java实现几种排序算法, 排序原来也挺有意思啊
- Adapter模式
- JAXB注解使用
- 第十篇 黑马程序员-IO输入输出流
- 用循环单链表实现约瑟夫环(不含头结点)
- ResponsiveSlides.js 使用
- C++的坑真的多吗?
- windows + visual studio 2010 配置SVN
- Bridge模式
- 程序员练级之路