static void Main(string[] args) { Circle c = new Circle(new Point(5, 5), 50.5); Console.WriteLine(c); DoStuffWithCircle((Circle)c.Clone()); Console.WriteLine(c); Rectangle r = new Rectangle(new Point(5, 5), new Point(10, 5), new Point(5, 10), new Point(10, 10)); Console.WriteLine(r); DoStuffWithRectangle((Rectangle)r.Clone()); Console.WriteLine(r); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// ShapeHolder s1 = new ShapeHolder(); s1.AddShape(c); s1.AddShape(r); Console.WriteLine(s1); DoStuffWithList((ShapeHolder)s1.Clone(), c); Console.WriteLine(s1); }
public static void DoStuffWithList(ShapeHolder s, ShapeBase newShape) { s.AddShape(newShape); }