{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

AlexLecture_AdaptorPattern - Adapter pattern Adaptors 2 1...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Adapter pattern Adaptors 2
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Problem: How to reuse behavior Suppose we want to design a GUI toolkit with widgets, such as Button , Slider , etc. Problem: Pressing the button should cause some operation to be invoked on some other object But Button must know the class of this other object in order to invoke that operation So how do we make Button reusable? 3 Running example Suppose we are given the class: class DocManager { public: ... void printDocument(); void saveDocument(); ... }; which is responsible for opening, closing, saving, and printing text documents 4
Image of page 2