当前位置:网站首页>[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
边栏推荐
- wx.getLocation(Object object)申请方法,最新版
- 14 MySQL view
- 零犀科技携手集智俱乐部:“因果派”论坛成功举办,“因果革命”带来下一代可信AI
- Problems encountered in the database
- Biased sample variance, unbiased sample variance
- wx. Getlocation (object object) application method, latest version
- 多普勒效应(多普勒频移)
- Zero rhino technology joined hands with the intelligence Club: the "causal faction" forum was successfully held, and the "causal revolution" brought the next generation of trusted AI
- Problem solving win10 quickly open ipynb file
- Wechat applet -- wxml template syntax (with notes)
猜你喜欢

激光slam学习记录

wx. Getlocation (object object) application method, latest version

Bao Yan notebook IV software engineering and calculation volume II (Chapter 8-12)

Online yaml to CSV tool

Problem solving win10 quickly open ipynb file

关于结构体所占内存大小知识

What are the functions of Yunna fixed assets management system?

FFT 学习笔记(自认为详细)

云呐|公司固定资产管理系统有哪些?

Fiddler Everywhere 3.2.1 Crack
随机推荐
What is a humble but profitable sideline?
7.5 simulation summary
Redis high availability - master-slave replication, sentinel mode, cluster
China Jinmao online electronic signature, accelerating the digitization of real estate business
14 MySQL view
什么叫做信息安全?包含哪些内容?与网络安全有什么区别?
QT -- thread
What if the C disk is not enough? Let's see how I can clean up 25g of temp disk space after I haven't redone the system for 4 years?
FFMPEG关键结构体——AVCodecContext
【LeetCode】5. Valid palindrome
Senparc.Weixin.Sample.MP源码剖析
PV static creation and dynamic creation
Determinant learning notes (I)
总结了 800多个 Kubectl 别名,再也不怕记不住命令了!
Miaochai Weekly - 8
XML configuration file (DTD detailed explanation)
【QT】Qt使用QJson生成json文件并保存
Wechat applet -- wxml template syntax (with notes)
单商户V4.4,初心未变,实力依旧!
QT--线程