Exemple #1
0
        static void Main(string[] args)
        {
            ICoffee coffee = new SimpleCoffee();

            PrintInfo(coffee);

            coffee = new WithMilk(coffee);
            PrintInfo(coffee);

            coffee = new WithSprinkles(coffee);
            PrintInfo(coffee);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            var espresso = new Espresso();

            Console.WriteLine($"{espresso.AsString()} costs {espresso.Cost()} $");

            var espressoWithMilk = new WithMilk(espresso);

            Console.WriteLine($"{espressoWithMilk.AsString()} costs {espressoWithMilk.Cost()} $");

            var espressoWithMilkAndSugar = new WithSugar(espressoWithMilk);

            Console.WriteLine($"{espressoWithMilkAndSugar.AsString()} costs {espressoWithMilkAndSugar.Cost()} $");

            Console.ReadKey();
        }