# 適配器(Adapter)模式
---

---
適配器(Adapter)模式
使接口不兼容的对象能够相互合作
---

---
Adapter 的三個部分
1. The adapter gets an **interface**, compatible with one of the existing objects.
2. Using this interface, the existing object can ^^safely^^ call the adapter’s methods.
3. Upon receiving a call, the adapter passes the request to the second object, but in a format and order that the second object expects.
---

---

---
[适配器设计模式(封装器模式)](https://refactoringguru.cn/design-patterns/adapter)
{"metaMigratedAt":"2023-06-15T17:55:50.591Z","metaMigratedFrom":"Content","title":"適配器(Adapter)模式","breaks":true,"contributors":"[{\"id\":\"55656006-7069-4b3c-b452-8f557a1d2ca8\",\"add\":630,\"del\":0}]"}