Adapter Design Pattern convert the interface of class into another interface that client is expecting. Adaptor lets classes work together that could not work because of incompatible interface. It resolves the interface conflict, make the code workable. It helps us to work with legacy code when we want to use old API.
We can implement Adapter Pattern in two ways:
- Using Private inheritance
- Using Composition.
Class Diagram with Private Inheritance.
Class Diagram with composition.
Class Diagram that example the real example and source code is available below image.