当前位置:网站首页>[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
边栏推荐
- Initialiser votre vecteur & initialisateur avec une liste Introduction à la Liste
- Problems encountered in the database
- 数据库遇到的问题
- 用列錶初始化你的vector&&initializer_list簡介
- 【EF Core】EF Core与C# 数据类型映射关系
- 总结了 800多个 Kubectl 别名,再也不怕记不住命令了!
- 20220703 周赛:知道秘密的人数-动规(题解)
- Research notes I software engineering and calculation volume II (Chapter 1-7)
- 14 MySQL view
- Fiddler Everywhere 3.2.1 Crack
猜你喜欢

【二叉搜索树】增删改查功能代码实现

同事悄悄告诉我,飞书通知还能这样玩

多普勒效应(多普勒频移)

Permission problem: source bash_ profile permission denied

Senparc. Weixin. Sample. MP source code analysis

Configuring OSPF GR features for Huawei devices

Determinant learning notes (I)

Spire Office 7.5.4 for NET

How to get all the values stored in localstorage

【NOI模拟赛】Anaid 的树(莫比乌斯反演,指数型生成函数,埃氏筛,虚树)
随机推荐
关于结构体所占内存大小知识
总结了 800多个 Kubectl 别名,再也不怕记不住命令了!
跟着CTF-wiki学pwn——ret2libc1
14 MySQL-视图
mysql-全局锁和表锁
教你在HbuilderX上使用模拟器运行uni-app,良心教学!!!
多普勒效應(多普勒頻移)
MySql——CRUD
Rsync remote synchronization
Teach you to run uni app with simulator on hbuilderx, conscience teaching!!!
18.(arcgis api for js篇)arcgis api for js点采集(SketchViewModel)
What are Yunna's fixed asset management systems?
JS 这次真的可以禁止常量修改了!
XML配置文件(DTD详细讲解)
FFMPEG关键结构体——AVCodecContext
How to get all the values stored in localstorage
Spreadjs 15.1 CN and spreadjs 15.1 en
How much do you know about the bank deposit business that software test engineers must know?
Qt 一个简单的word文档编辑器
Open3D 点云随机添加噪声