Exemplo n.º 1
0
        private void RunTemplateMethodExample()
        {
            Coffee coffee = new Coffee();

            coffee.PrepareBeverage();

            Tea tea = new Tea();

            tea.PrepareBeverage();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Tea lemonTea = new Tea();

            lemonTea.PrepareBeverage();

            Console.WriteLine();

            Coffee coffeeWithMilkAndSugar = new Coffee();

            coffeeWithMilkAndSugar.PrepareBeverage();

            Console.ReadKey();
        }
Exemplo n.º 4
0
        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");
        }