previous | start | next

## Template Method

- `drawSelection` calls `draw`
- Must declare `draw` in `SelectableShape`
- No implementation at that level!
- Declare as abstract method`
  public abstract void draw(Graphics2D g2)`
- Defined in `CarShape`, `HouseShape`
- `drawSelection` method calls `draw`, `translate`
- `drawSelection` doesn't know which methods--polymorphism
- `draw` `Selection` is a template method
- Ch6/scene2/SelectableShape.java
- Ch6/scene2/HouseShape.java

previous | start | next