예제 #1
0
        public override CakeBase Copy()
        {
            CakeBase cb = new WhippedCream(name, NextBase);

            if (NextBase != null)
            {
                ((ToppingBase)cb).NextBase = NextBase.Copy();
            }
            return(cb);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Drink drink = new Expresso();

            Console.WriteLine(drink.DownloadDescribe() + drink.Cost() + " zł");

            Drink drink1 = new StarCafeSpecial();

            drink1 = new Chcoclatte(drink1);
            drink1 = new WhippedCream(drink1);
            drink1 = new Chcoclatte(drink1);
            drink1 = new AddSugar(drink1);
            Console.WriteLine(drink1.DownloadDescribe() + " " + drink1.Cost() + " zł");
            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            ICoffee latte = new Latte();

            latte = new WhippedCream(latte);
            latte = new Caramel(latte);
            latte = new SoyMilk(latte);
            Console.WriteLine(latte.ShowInfo());
            Console.WriteLine();

            ICoffee espresso = new Espresso();

            Console.WriteLine(espresso.ShowInfo());
            Console.WriteLine();

            ICoffee cappuccino = new Cappuccino();

            cappuccino = new SoyMilk(cappuccino);
            cappuccino = new Caramel(cappuccino);
            Console.WriteLine(cappuccino.ShowInfo());
        }