Adapter Design Pattern - SYSC3020-Winter2016/SYSC3020LectureNotes GitHub Wiki

Intent

  • Convert the interface of a class into another interface clients expect.
  • Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
  • Create a new interface for an object that does the right stuff but has the wrong interface.
  • Typical application contexts: reuse of existing code, off-the-shelf software

Structure

With Inheritance

Alt

(requires multiple inheritance. In java this would be done with one class inheritance and one an interface implementation)

With Delegation

Alt

⚠️ **GitHub.com Fallback** ⚠️