Template Method Pattern (Template Method)



 GOF Intent: Define the skeleton of an algorithm in an operation, while deferring some steps to subclasses. (Solution to fix step behavior)

 

Role:

1 Abstract Class: Implements the template method and defines the skeleton of the algorithm.

 

2 Concrete Class (ConcreteClass): implements the abstract methods in the abstract class, and has completed the complete algorithm.

 

Implementation points: Fixed steps are defined as abstract methods in the parent class.

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326846803&siteId=291194637