The Adapter Pattern

The Adapter Design Pattern allows you to make an existing class work with other existing class libraries without changing the code of the existing class.

We often need to use the methods of an existing class to work with other existing libraries. The way to do this is by creating another class, named the Adapter, that inherits from the existing class while implementing the interface of the existing library. The end result is that the Adapter can call the method of the existing class (since the Adapter inherits from the existing class) and can work in the existing library (since the Adapter implements the interface of the existing library).

Last edited May 12, 2014 at 11:38 AM by crisma_victoria, version 4