Adapter PatternThe Adapter pattern allows you to provide an object instance to a client that has a dependency on an interface that your instance does not implement.
The implementation of adapter pattern called Object AdapterExist two ways of the implements the adapter pattern, bellow you can see the object adapter pattern.
Now think that we already have a great implementation of code that do anything.
But the client can't be altered to fit the desired interface that you can see below.
To resolve this problem an Adapter class is created that fulfills the desired interface of the client and basically will implements the method of the interface that calls the method of the our great implementation.
And finally, below the client using the adapter.
This was a simple implementation of class adapter only to learn the principle of the pattern. In real world the implementations will be more hard but the principle will remain being simple.
Main photo by Murat Onder at Unsplash.
Thank you for reading and if you have a question use the comments!