Template method#
The intent of the template method pattern is to define a skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure.
Structure#
classDiagram
AbstractClass <|-- ConcreteClass1
AbstractClass <|-- ConcreteClass2
AbstractClass <|-- ConcreteClass3
class AbstractClass{
+algorithm()
+step1()
+step2()
}
class ConcreteClass1{
+step1()
+step2()
}
class ConcreteClass2{
+step1()
+step2()
}
class ConcreteClass3{
+step2()
}