Design Patterns Explained Java Code Examples – Chapter 7: The Adapter Pattern

Chapter 7: The Adapter Pattern
Code Examples

Example 7-1: Implementing the Adapter Pattern

TOC


An example of wrapping is shown in Example 7-1.

Example 7-1: Implementing the Adapter Pattern

TOP

class Circle extends Shape {
    ...
    private XXCircle myXXCircle;
    ...
    public Circle () {
        myXXCircle= new XXCircle();
    }
    void public display() {
        myXXCircle.displayIt();
    }
    ...
}