当前位置:网站首页>[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
边栏推荐
- After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!
- 亲测可用fiddler手机抓包配置代理后没有网络
- 如何获取localStorage中存储的所有值
- [SQL] SQL expansion languages of mainstream databases (T-SQL, pl/sql, pl/pgsql)
- 提升工作效率工具:SQL批量生成工具思想
- How to get all the values stored in localstorage
- 【NOI模拟赛】Anaid 的树(莫比乌斯反演,指数型生成函数,埃氏筛,虚树)
- DEJA_ Vu3d - cesium feature set 055 - summary description of map service addresses of domestic and foreign manufacturers
- What are Yunna's fixed asset management systems?
- Research notes I software engineering and calculation volume II (Chapter 1-7)
猜你喜欢
Teach you to run uni app with simulator on hbuilderx, conscience teaching!!!
上门预约服务类的App功能详解
【NOI模拟赛】Anaid 的树(莫比乌斯反演,指数型生成函数,埃氏筛,虚树)
多普勒效应(多普勒频移)
Spreadjs 15.1 CN and spreadjs 15.1 en
20220703 week race: number of people who know the secret - dynamic rules (problem solution)
Miaochai Weekly - 8
PADS ROUTER 使用技巧小记
微信小程序---WXML 模板语法(附带笔记文档)
[day39 literature extensive reading] a Bayesian perspective on magnetic estimation
随机推荐
Make a short video clip number of we media film and television. Where can I download the material?
Tools to improve work efficiency: the idea of SQL batch generation tools
21. PWM application programming
Yunna | what are the main operating processes of the fixed assets management system
[SQL] SQL expansion languages of mainstream databases (T-SQL, pl/sql, pl/pgsql)
[Luogu p3295] mengmengda (parallel search) (double)
What are Yunna's fixed asset management systems?
PV static creation and dynamic creation
CloudCompare&PCL 点云随机添加噪声
MySQL global lock and table lock
QT -- thread
Hardware and interface learning summary
Biased sample variance, unbiased sample variance
FFMPEG关键结构体——AVFrame
QT a simple word document editor
How much do you know about the bank deposit business that software test engineers must know?
时区的区别及go语言的time库
跟着CTF-wiki学pwn——ret2libc1
Wechat applet -- wxml template syntax (with notes)
15 MySQL-存储过程与函数