using System.Collections.Generic;
public static void Main()
var rect1 = new Rectangle {Length = 10, Width = 20};
var rect2 = new Rectangle {Length = 100, Width = 200};
Console.WriteLine(rect1.CompareTo(rect2));
public double Length{get; protected set;}
public double Width {get; protected set;}
public virtual double GetArea()
public void changePolygonLength(double newLength)
public virtual void Draw()
Console.WriteLine("Drawing: Polygon");
class Rectangle: Polygon, IComparable
public new double Length {get; set;}
public new double Width {get; set;}
public override void Draw()
Console.WriteLine("Drawing: Rectangle");
public new double GetArea()
public int CompareTo(Object obj)
throw new ArgumentException();
Rectangle target = (Rectangle)obj;
double diff = this.GetArea() - target.GetArea();
public Triangle(double @base, double height)
public override double GetArea()
return 0.5 * Length * Width;
public override void Draw()
Console.WriteLine("Drawing: Triangle");
public interface ILoveYou
string ILoveYou.Lover{get; set;}
string ILoveYou.Loved{get; set;}