The Template Method design pattern provides a solution:
Define abstract operations (primitives) for the variant parts of a behavior.
Define a template method that
- implements the invariant parts of a behavior and
- calls primitives that subclasses implement.
Describing the Template Method design in more detail is the theme of the following sections.
See Applicability section for all problems Template Method can solve. [BGI]

Background Information