当前位置:网站首页>[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
边栏推荐
- Laser slam learning record
- 2022.7.5-----leetcode.729
- How to get all the values stored in localstorage
- 妙才周刊 - 8
- QT QPushButton details
- The use of El cascader and the solution of error reporting
- JVM details
- Problems encountered in the database
- Chapter 16 oauth2authorizationrequestredirectwebfilter source code analysis
- 跟着CTF-wiki学pwn——ret2libc1
猜你喜欢

【DesignMode】组合模式(composite mode)

China Jinmao online electronic signature, accelerating the digitization of real estate business

Laser slam learning record

Yunna | what are the main operating processes of the fixed assets management system

C reflection and type

Configuring OSPF load sharing for Huawei devices

GD32F4xx uIP协议栈移植记录

Breadth first search open turntable lock

Initialize your vector & initializer with a list_ List introduction

GFS Distributed File System
随机推荐
Cloudcompare & PCL point cloud randomly adds noise
After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!
用列錶初始化你的vector&&initializer_list簡介
[QT] QT uses qjson to generate JSON files and save them
多普勒效应(多普勒频移)
妙才周刊 - 8
C# 文件与文件夹操作
【EF Core】EF Core与C# 数据类型映射关系
Huawei equipment is configured with OSPF and BFD linkage
【在线聊天】原来微信小程序也能回复Facebook主页消息!
JVM details
Open3D 点云随机添加噪声
7.5 simulation summary
C# 反射与Type
QT -- thread
Add noise randomly to open3d point cloud
【NOI模拟赛】Anaid 的树(莫比乌斯反演,指数型生成函数,埃氏筛,虚树)
How to get all the values stored in localstorage
GFS分布式文件系統
Use CAS instead of synchronized