Пример #1
0
        private void btnTestDecoratorPattern_Click(object sender, EventArgs e)
        {
            Beverage drink1 = new HouseBlend(); // use Beverage type to hold this variable because it can be decorated.

            Console.WriteLine(drink1.GetDescription() + ". cost = " + drink1.cost().ToString());

            drink1 = new Mocha(drink1); // converting an object1 (HouseBlend) to another object2 (Whip) by decoration. Both objects are still a Beverage.

            Console.WriteLine(drink1.GetDescription() + ". cost = " + drink1.cost().ToString());
        }