예제 #1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Bank Account!");
     TwoDShap[] shapes = new TwoDShap[4];
     shapes[0] = new Triangle("right", 8.0, 12.0);
     shapes[1] = new Rectangle(10);
     shapes[2] = new Rectangle(10, 4);
     shapes[3] = new Triangle(7.0);
     for (int i = 0; i < shapes.Length; i++)
     {
         Console.WriteLine("object is " + shapes[i].name);
         Console.WriteLine("Area is " + shapes[i].Area());
         Console.WriteLine();
     }
 }
예제 #2
0
 // Construct a copy of a TwoDShape object.
 public TwoDShap(TwoDShap obj)
 {
     Width  = obj.Width;
     Height = obj.Height;
 }