public int X { get; set; }
public int Y { get; set; }
public int Height { get; set; }
public int Width { get; set; }
public virtual void Draw()
Console.WriteLine("Performing base class drawing tasks");
public override void Draw()
Console.WriteLine("Drawing a circle");
public override void Draw()
Console.WriteLine("Drawing a rectangle");
public override void Draw()
Console.WriteLine("Drawing a triangle");
public static void Main()
System.Collections.Generic.List<Shape> shapes = new System.Collections.Generic.List<Shape>();
shapes.Add(new Rectangle());
shapes.Add(new Triangle());
shapes.Add(new Circle());
foreach (Shape s in shapes)
((Rectangle)shapes[0]).Draw();
((Shape)shapes[0]).Draw();
Shape s1 = new Rectangle();