Esempio n. 1
0
        static void Main(string[] args)
        {
            ICoffee expresso = new Expresso();

            Console.WriteLine($"Expresso price = {expresso.GetCost()}");

            ICoffee milkCoffee = new MilkDecorator(new Expresso());

            Console.WriteLine($"Expresso with milk price = {milkCoffee.GetCost()}");

            ICoffee chocolateCoffe = new ChocolateDecorator(new Expresso());

            Console.WriteLine($"Expresso with chocolate price = {chocolateCoffe.GetCost()}");

            ICoffee tastyCoffee = new MilkDecorator(new ChocolateDecorator(new Expresso()));

            Console.WriteLine($"Expresso with milk and chocolate costs {tastyCoffee.GetCost()}");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ICoffee coffee = new MilkDecorator(new ChocolateDecorator(new Espresso()));

            Console.WriteLine(coffee.Description);
        }