Template Method Pattern : Template Pattern : Design Patterns C# Source Code


Custom Search

C# Source Code » Design Patterns » Template Pattern »

 

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();
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Design Patterns
» Template Pattern