コード例 #1
0
        public void Run()
        {
            //CodeBuilder.Demo();
            //MyStringBuilder.Demo();
            //Dragon.Demo();
            //ShapesDecoratorDemo();
            var redSquare = new ColoredShape <SquareImp>();

            WriteLine(redSquare.AsString());

            var transparentShape = new TransparentShape <ColoredShape <SquareImp> >(1);

            WriteLine(transparentShape.AsString());
        }
コード例 #2
0
        private static void ShapesDecoratorDemo()
        {
            var square = new Square(1.24f);

            WriteLine(square.AsString);

            var redSquare = new ColoredShape(square, "Red");

            WriteLine(redSquare.AsString);

            var transparentRedSquare = new TransparentShape(redSquare, 1.2f);

            WriteLine(transparentRedSquare.AsString);
        }