A template method is a method that the whole thing and the sequences to achieve this could be remained, but the detailed steps could be customized as the requirement changed.
class Thing
{
public:
// This is the template method.
void start()
{
step1();
step2();
step3();
}
virtual ~Thing() {}
private:
virtual void step1() {}
virtual void step2() {}
virtual void step3() {}
};
class Something : public Thing
{
private:
virtual void step1 (){ /* do setp 1 */}
virtual void step2 (){ /* do setp 2 */}
virtual void step3 (){ /* do setp 3 */}
};
The logic in start method can remain the same, the steps could be customized as needed.