示例#1
0
 static void Main(string[] args)
 {
     Triangle tri = new Triangle();
     tri.basen = 3;
     tri.height = 4;
     Console.WriteLine("Triangle area = " + tri.Area());
     Circle cir = new Circle();
     cir.radius = 5;
     Console.WriteLine("Circle area = " + cir.Area());
     Rectangle rec = new Rectangle();
     rec.height = 5;
     rec.width = 4;
     Console.WriteLine("Rectangle area = " + rec.Area());
     Square squ = new Square();
     squ.width = 6;
     Console.WriteLine("Square area = " + squ.Area());
     Console.ReadKey();
 }