โ CS Visual Lab ยท Design Patterns
๐ Adapter
๐ก The ideaWrap an existing class so its interface matches the one your code expects, without changing either side.
๐ In real lifeA travel plug adapter: your Indian charger fits a UK socket without changing the charger or the wall.
๐ฌ Watch it work
Step 1 of 4
What your code expects
Your app pays through one interface.
interface PaymentGateway { pay(rupees: number): Promise<string> }