Design Patterns – Template method

Template_1

Template method is a simple design pattern, and very similar to the strategy pattern. While the strategy pattern changes an entire algorithm, the template method changes only some parts of the algorithm, leaving the rest of it unchanged.
 
The template method signature is a function that contains multiple calls (of both virtual and non-virtual functions). The virtual functions can be overridden in subclasses, changing only that part of the algorithm functionality.

The full code can be found at the following link:
https://github.com/badearobert/cplusplus

Leave a comment

Your email address will not be published.