SE450: TEMPLATE METHOD Pattern [37/65] Previous pageContentsNext page

Solution

  1. Define a superclass that has a method for the algorithm and abstract methods for the primitive operations.
  2. Implement the algorithm to call the primitive operations in the appropriate order.
  3. Do not define the primitive operations in the superclass, or define them to have appropriate default behavior.
  4. Each subclass defines the primitive operations but not the algorithm.

Previous pageContentsNext page