static void Main()
        {
            TwoDShape[] shapes = new TwoDShape[4];

            shapes[0] = new Triangle("прямоугольный", 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("Объект — " + shapes[i].name);
                Console.WriteLine("Площадь равна " + shapes[i].Area());

                Console.WriteLine();
            }
        }
 // Сконструировать копию объекта TwoDShape.
 public TwoDShape(TwoDShape ob)
 {
     Width  = ob.Width;
     Height = ob.Height;
     name   = ob.name;
 }
Beispiel #3
0
 // Сконструировать копию объекта TwoDShape.
 public TwoDShape(TwoDShape ob)
 {
     Width  = ob.Width;
     Height = ob.Height;
 }