public Figure(string name)
public virtual void Display()
Console.WriteLine($"Figure: {name}");
public class Rectangle : Figure
private int x1, y1, x2, y2;
public Rectangle(string name, int x1, int y1, int x2, int y2)
: this("Rectangle", 0, 0, 1, 1)
public override void Display()
Console.WriteLine($"Coordinates: ({x1}, {y1}), ({x2}, {y2})");
return Math.Abs((x2 - x1) * (y2 - y1));
public class RectangleColor : Rectangle
public RectangleColor(string name, int x1, int y1, int x2, int y2, string color)
: base(name, x1, y1, x2, y2)
: this("Colored Rectangle", 0, 0, 1, 1, "Red")
public override void Display()
Console.WriteLine($"Color: {color}");
Figure baseFigure = new Figure("Base Figure");
Rectangle rectangle = new Rectangle("My Rectangle", 1, 2, 4, 6);
Console.WriteLine($"Area: {rectangle.Area()}");
RectangleColor coloredRectangle = new RectangleColor("Colored Rectangle", 2, 3, 5, 8, "Blue");
coloredRectangle.Display();
Console.WriteLine($"Area: {coloredRectangle.Area()}");