Beispiel #1
0
        static void Main(string[] args)
        {
            //Duck sd = new Duck("Donald", new ShortQuack());
            //sd.PerformQuack();


            Beverage beverage = new Espresso();

            beverage = new Mocha(beverage);
            beverage = new Mocha(beverage);
            beverage = new FreshMilk(beverage);

            Console.WriteLine(beverage.getDescription() + "  $" + beverage.cost());

            //Student student1 = new Student("Duyen", 22);

            //Console.WriteLine(student1.GetTuoi());
        }
Beispiel #2
0
        private void DecoratorTest_Click(object sender, RoutedEventArgs e)
        {
            Beverage beverage1 = new Espresso();

            PrintBeverage(beverage1);

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            PrintBeverage(beverage2);

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            PrintBeverage(beverage3);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Beverage beverage1 = new Espresso();

            Console.WriteLine(beverage1.ToString() + " $" + beverage1.Cost());

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2.ToString() + " $" + beverage2.Cost());

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.ToString() + " $" + beverage3.Cost());

            Console.ReadLine();
        }