当前位置:网站首页>[designmode] adapter pattern
[designmode] adapter pattern
2022-07-06 00:00:00 【weixin_ forty-three million two hundred and twenty-four thousan】
- Basic introduction
Adapter pattern (Adapter Pattern) Convert the interface of a class to another interface representation that the client expects , The main purpose is compatibility , Allows two classes that would otherwise not work together because of interface mismatches to work together . It is alias wrapper (Wrapper)
Adapter mode belongs to structural mode
It is mainly divided into three categories : Adapter like pattern 、 Object adapter pattern 、 Interface adapter mode
1. Examples of adapters in real life
The socket in Thailand uses two holes ( European standard ), You can buy a multi-function plug ( Adapter ) , So you can use .
2. Basic introduction
Adapter pattern (Adapter Pattern) Convert the interface of a class to another interface representation that the client expects , The main purpose is compatibility , Allows two classes that would otherwise not work together because of interface mismatches to work together . It is alias wrapper (Wrapper)
Adapter mode belongs to structural mode
It is mainly divided into three categories : Adapter like pattern 、 Object adapter pattern 、 Interface adapter mode
3. working principle
Adapter pattern : Convert the interface of one class to another . Make classes that are not compatible with the original interface compatible
From the user's point of view, there is no adapter , It's decoupled
The user calls the target interface method transformed by the adapter , The adapter then calls the relevant interface methods of the adapter
Users receive feedback , It just feels like interacting with the target interface , Pictured
边栏推荐
- 多普勒效应(多普勒频移)
- 什么叫做信息安全?包含哪些内容?与网络安全有什么区别?
- My colleagues quietly told me that flying Book notification can still play like this
- 权限问题:source .bash_profile permission denied
- USB Interface USB protocol
- Initialize your vector & initializer with a list_ List introduction
- 用列表初始化你的vector&&initializer_list简介
- 【QT】Qt使用QJson生成json文件并保存
- Rsync remote synchronization
- Redis high availability - master-slave replication, sentinel mode, cluster
猜你喜欢
Initialize your vector & initializer with a list_ List introduction
时区的区别及go语言的time库
How much do you know about the bank deposit business that software test engineers must know?
PV static creation and dynamic creation
关于结构体所占内存大小知识
PV静态创建和动态创建
CAS and synchronized knowledge
20220703 week race: number of people who know the secret - dynamic rules (problem solution)
Part III Verilog enterprise real topic of "Niuke brush Verilog"
亲测可用fiddler手机抓包配置代理后没有网络
随机推荐
C# 反射与Type
NSSA area where OSPF is configured for Huawei equipment
PADS ROUTER 使用技巧小记
Huawei equipment is configured with OSPF and BFD linkage
Zhongjun group launched electronic contracts to accelerate the digital development of real estate enterprises
云呐|公司固定资产管理系统有哪些?
QT -- thread
Part III Verilog enterprise real topic of "Niuke brush Verilog"
15 MySQL stored procedures and functions
Add noise randomly to open3d point cloud
DEJA_VU3D - Cesium功能集 之 055-国内外各厂商地图服务地址汇总说明
Upgrade openssl-1.1.1p for openssl-1.0.2k
FFMPEG关键结构体——AVCodecContext
QT--线程
Problems encountered in the database
el-cascader的使用以及报错解决
Knowledge about the memory size occupied by the structure
MySQL global lock and table lock
PV静态创建和动态创建
7.5 simulation summary