当前位置:网站首页>[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
边栏推荐
- China Jinmao online electronic signature, accelerating the digitization of real estate business
- 激光slam学习记录
- C# 反射与Type
- 教你在HbuilderX上使用模拟器运行uni-app,良心教学!!!
- Make a short video clip number of we media film and television. Where can I download the material?
- NSSA area where OSPF is configured for Huawei equipment
- Shardingsphere source code analysis
- Wechat applet -- wxml template syntax (with notes)
- Zhuan: in the future, such an organization can withstand the risks
- What are Yunna's fixed asset management systems?
猜你喜欢
After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!
Mathematical model Lotka Volterra
Upgrade openssl-1.1.1p for openssl-1.0.2k
单商户V4.4,初心未变,实力依旧!
【在线聊天】原来微信小程序也能回复Facebook主页消息!
18. (ArcGIS API for JS) ArcGIS API for JS point collection (sketchviewmodel)
时区的区别及go语言的time库
Learn PWN from CTF wiki - ret2libc1
Problem solving win10 quickly open ipynb file
wx. Getlocation (object object) application method, latest version
随机推荐
wx.getLocation(Object object)申请方法,最新版
21. PWM application programming
Spire Office 7.5.4 for NET
【LeetCode】5. Valid palindrome
XML configuration file (DTD detailed explanation)
Initialize your vector & initializer with a list_ List introduction
14 MySQL-视图
Breadth first search open turntable lock
PADS ROUTER 使用技巧小记
Redis high availability - master-slave replication, sentinel mode, cluster
7.5模拟赛总结
C reflection and type
DEJA_ Vu3d - cesium feature set 055 - summary description of map service addresses of domestic and foreign manufacturers
Fiddler Everywhere 3.2.1 Crack
15 MySQL-存储过程与函数
Rsync remote synchronization
Single merchant v4.4 has the same original intention and strength!
USB Interface USB protocol
Use mapper: --- tkmapper
Yunna | what are the main operating processes of the fixed assets management system