The next two chapters examine a design technique known as wrapping. Wrapping denotes a close relationship between two classes, called the wrapper class and the wrapped class. The sole purpose of the wrapper class is to modify or enhance the functionality of its wrapped class. Wrapping corresponds perfectly to the Open/Closed design rule: If you need a class to behave slightly differently then don’t modify it. Instead, create a new class that wraps it.
This chapter covers the concept of an adapter, which is a wrapper that changes the functionality of the class it wraps. This chapter presents several examples ...