An Adapter is used for adapting some existent classes to a certain interface. Usually we have two styles of Adapter, one realized with inheritance and the other with delegate.
It is a natural idea to have a class multiplely inherited from the interface and the implemented class. In this way, the inherited class can have a public interface and a private implementation which is intended to hide from the users. Hence the following figure illustrate the idea:
However, the class Adapter has some difficulty if it is used to adapt several Adaptees. In this case the follow method is preferable:
A two-way adapter can make two interfaces transparent.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment