/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
scripts/oop-practice-sources/csharp/figure.cs
37 строк
688 B
Spirzen
OOP
09 июн 2026, 20:58
09 июн 2026, 20:58
1dca232
Код
Авторство
О чём код?
class Figure { public string Name { get; } public string Color { get; } public Figure(string name, string color) { Name = name; Color = color; } public void Describe() { Console.WriteLine($"Фигура «{Name}», цвет: {Color}"); } } class Circle : Figure { public Circle(string color) : base("Круг", color) { } } class Square : Figure { public Square(string color) : base("Квадрат", color) { } } class Program { static void Main() { var circle = new Circle("красный"); var square = new Square("синий"); circle.Describe(); square.Describe(); } }