What is the need for Template Method Pattern in C#?Most of you
might have already implemented this template method pattern in your program
unknowingly. Have you used inheritance in your program with an intension
that one or more methods of the base class have to be implemented by its
derived class? Then you have used template method pattern.
Simple example to template method pattern will be an abstract base class whose methods are implemented in its derived class. This example is demonstrated below: abstract
class baseClass { In this example, templateMethod is implemented by baseClass but the method abstractMethod1 is not implemented by baseClass. It is expected to be implemented by the derived class of baseClass. That is where template method pattern is utilized.
|