The Template Method Pattern abstracts away the details of several algorithms. The generic part of an algorithm is contained within a base class. Particular implementation details are captured within base classes. The generic pattern of classes involved looks like this:
In this example,
Accumulator captures the essence of the accumulation algorithm. The base classes
Product provide particular customised ways to use the generic accumulation algorithm.