Пример #1
0
        static void DecoratorTest()
        {
            Decorator.IShape circle       = new Decorator.Circle();
            Decorator.IShape redCircle    = new RedShapeDecorator(new Decorator.Circle());
            Decorator.IShape blueCircle   = new BlueShapeDecorator(new Decorator.Circle());
            Decorator.IShape redRectangle = new RedShapeDecorator(new Decorator.Rectangle());

            Decorator.IShape redBlueCircle = new RedShapeDecorator(new BlueShapeDecorator(new Decorator.Circle()));


            Console.WriteLine("Circle with normal border");
            circle.draw();


            Console.WriteLine("\nCircle of red border");
            redCircle.draw();

            Console.WriteLine("\nRectangle of red border");
            redRectangle.draw();

            Console.WriteLine("\nCircle of red and blue border ");
            redBlueCircle.draw();
        }