public Chapter3() { TwoDShape[] shapes = new TwoDShape[5]; shapes[0] = new TriangleTwoD("right", 8.0, 12.0); //прямоугольный shapes[1] = new RectangleTwoD(10); shapes[2] = new RectangleTwoD(10, 4); shapes[3] = new TriangleTwoD(7.0); shapes[4] = new TwoDShape(10, 20, "generic form"); foreach (TwoDShape obj in shapes) { Console.WriteLine("object is " + obj.name); Console.WriteLine("area is " + obj.Area()); Console.WriteLine(); } }
public TriangleTwoD(TriangleTwoD obj) : base(obj) { this.Style = obj.Style; }