private void RunTemplateMethodExample() { Coffee coffee = new Coffee(); coffee.PrepareBeverage(); Tea tea = new Tea(); tea.PrepareBeverage(); }
public static void Main(string[] args) { Console.WriteLine("Preparing Coffee -->\n"); Beverage coffee = new Coffee(); coffee.PrepareBeverage(); Console.WriteLine("\nPreparing Tea -->\n"); Beverage tea = new Tea(); tea.PrepareBeverage(); }
static void Main(string[] args) { Tea lemonTea = new Tea(); lemonTea.PrepareBeverage(); Console.WriteLine(); Coffee coffeeWithMilkAndSugar = new Coffee(); coffeeWithMilkAndSugar.PrepareBeverage(); Console.ReadKey(); }
public static void TestTemplateMethod() { Console.WriteLine("----------Template method----------"); Tea teaWithoutCondiments = new Tea(false); Tea teaWithCondiments = new Tea(true); Coffee coffeeWithoutCondiments = new Coffee(false); Coffee coffeeWithCondiments = new Coffee(true); Console.WriteLine("\nTea without condiments:"); teaWithoutCondiments.PrepareBeverage(); Console.WriteLine("\nTea with condiments:"); teaWithCondiments.PrepareBeverage(); Console.WriteLine("\nCoffee without condiments:"); coffeeWithoutCondiments.PrepareBeverage(); Console.WriteLine("\nCoffee with condiments:"); coffeeWithCondiments.PrepareBeverage(); Console.WriteLine("----------------------------------\n"); }