Материал из .Net Framework эксперт
Template Method Pattern
using System;
public abstract class Calculate {
public abstract void PositionLabel();
public void SetupCalculate() {
this.PositionLabel();
}
public Calculate() {}
}
public class CalculateDeluxe : Calculate {
public override void PositionLabel() {
Console.WriteLine("Deluxe clock");
}
public CalculateDeluxe() { ;}
}
public class CalculateStandard : Calculate {
public override void PositionLabel() {}
public CalculateStandard() {}
}
class Client {
static void Main(string[] args) {
Calculate delCalculate = new CalculateDeluxe();
delCalculate.SetupCalculate();
Calculate stdCalculate = new CalculateStandard();
stdCalculate.SetupCalculate();
}
}