Design Patterns · Junior · Question 22 of 75
What is the Template Method pattern?
- ✓Correct answer: A base algorithm defines the steps, and subclasses override individual steps
- 2A method that generates HTML markup from a string template
- 3A method copied between projects without any changes
Explanation
For example, a base class DataExporter defines export(): load → transform → save, and subclasses implement transform() for CSV and JSON. In a functional style, the same is done by passing step functions.