previous | start | next

## Inflexible Hierarchies

- How can one add operations to compound hierarchies?
- Example: AWT `Component,` `Container,` etc. form hierarchy
- Lots of operations: `getPreferredSize`,`repaint`
- Can't add new methods without modifying `Component` class
- VISITOR pattern solves this problem
- Each class must support one method
  `void accept(Visitor v)`

previous | start | next