Pattern TEMPLATE METHOD


Solution

  1. Define the algorithm in the base class
  2. The algorithm calls the primitive operations in order
  3. Define the primitive operations as virtual functions in base class, with appropriate default behavior, or leave undefined
  4. Each derived class defines the primitives, but not the algorithm

prev |top |next