CS FundamentalsHardIBM · Deloitte pattern

Your application expects a PaymentGateway interface, but the third-party library you must use exposes a different API. Which pattern lets you use it without changing either side?

  1. A. Decorator
  2. B. Facade
  3. C. Adapter
  4. D. Proxy

Correct answer: C. Adapter

An Adapter wraps the library and converts its interface into the one the client expects. A Facade simplifies a subsystem but does not match an existing target interface; Decorator adds behaviour with the same interface.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic