The template method pattern basically defines the steps of an algorithm inside a class as a contract while deferring some of the steps (methods) to be implemented by the derived classes; hence, it primarily defines the structure via an abstract base class.
We will explain its implementation using an example in continuation of our sample for a GUI app we created earlier for the abstract factory pattern. In fact, within the same example app, we cover abstract factory, builder, and template method patterns.
In the abstract factory example, we presented the IUIAbsFactory interface and mentioned two of the possible implementations as DarkUIAbsFactory and LightUIAbsFactory concrete factory classes. Since the difference ...