适配器模式
来源:互联网 发布:经济和信息化数据平台 编辑:程序博客网 时间:2024/05/18 04:00
适配器模式:将一个类的接口转换成客户希望的另外一个接口。Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ap{ public class Target { public virtual void Request() { Console.WriteLine("Request"); } } public class Adaptee { public void SpecifyRequest() { Console.WriteLine("SpecifyRequest"); } } public class Adapter : Target { private Adaptee adp = new Adaptee(); public override void Request() { adp.SpecifyRequest(); } } class Program { static void Main(string[] args) { Target t = new Adapter(); t.Request(); Console.Read(); } }}
0 0
- 适配器及适配器模式
- 适配器及适配器模式
- 适配器模式(类适配器)
- 适配器模式(默认适配器)
- 适配器模式(对象适配器)
- 适配器模式-类适配器
- 适配器模式-对象适配器
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- 适配器模式
- Remove Nth Node From End of List
- 黑马程序员—JAVA基础学习日志——由synchronized线程锁引发
- 关于java的动态代理
- 做让自己快乐的事,有利的事——我被骗了
- 国内Java学习网站汇总
- 适配器模式
- 比较好的winform-dataGridView例程网站
- 定义一个TreeMap,键存储的是书对象,值存储的是字符串。 根据书的出版出版日期排序。
- 设计模式-中介者模式
- 认清自己的位置
- OC基础教程1-Hello Wrold(OS X版)
- jdk1.5新特性之-------静态导入
- C#中的线程(三) 使用多线程
- C 【block类型全方位详解】