示例#1
0
        static void Main(string[] args)
        {
            IIndex <Rectangle> rectangle = RectangleCollection.GetRectangle();
            IIndex <Shape>     shape     = rectangle;

            for (int i = 0; i < shape.Count; i++)
            {
                Console.WriteLine(shape[i]);
            }
            IDsplay <Shape>     shapeDisplay     = new ShapeDisplay();
            IDsplay <Rectangle> rectangleDisplay = shapeDisplay;

            rectangleDisplay.Show(rectangle[0]);
        }
示例#2
0
 public static RectangleCollection GetRectangle()
 {
     return(coll ?? (coll = new RectangleCollection()));
 }