A payment provider changed its SDK method names, but your application wants to keep using the same PaymentGateway interface. Which pattern fits best?
Practice this question from Quiz: Design Patterns, with options and an explanation.
Question
A payment provider changed its SDK method names, but your application wants to keep using the same PaymentGateway interface. Which pattern fits best?
Option A — Correct answer
Adapter
Adapter wraps the changed SDK behind the interface your app already uses.
Option B
Singleton
Option C
Builder
Option D
Iterator
Explanation
Adapter is used when an existing class has an incompatible interface and you need to wrap it behind the interface your app expects.