コード例 #1
0
ファイル: Program.cs プロジェクト: reficul0/Decorator
        static void Main(string[] args)
        {
            IBeverage b = new Coffe();

            b = new Milk(b);
            b = new Milk(b);

            b = new Chocolate(b);

            var formater = new DefaultOutputFormatDecorator(b);

            formater.Print();

            //PrintBeverage(b);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ltvnvchil/Decorator
        static void Main(string[] args)
        {
            int big    = (int)SizesOfPortion.big;
            int medium = (int)SizesOfPortion.medium;
            int small  = (int)SizesOfPortion.small;



            IBeverage beverage = new Coffe(size: medium);

            beverage = new Milk(beverage, size: big);
            beverage = new Chocolate(beverage, size: small);

            var formater = new DefaultOutputFormatDecorator(beverage);

            formater.Print();
            Console.ReadLine();
        }