Template Method

Intent

Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

Participants

Other Terms

Notes

Many primitive and hook operations and helper methods are only invoked by concrete classes. Such operations and methods can be declared protected.

Example