/
dOJer113
/
Insect
Обзор
Документация
Войти
/
dOJer113
/
Insect
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
insects/Ladybug.cs
42 строки
940 B
alex
Валидация
21 дек 2025, 20:06
21 дек 2025, 20:06
640f9dc
Код
Авторство
О чём код?
using System.ComponentModel.DataAnnotations; using CommunityToolkit.Mvvm.ComponentModel; namespace insects; /// <summary> /// Божья коровка. /// </summary> public partial class Ladybug : Beetle { [ObservableProperty] private int _numberOfSpots; public override string TypeName => nameof(Ladybug); public Ladybug() : base() { NumberOfSpots = 7; } public Ladybug(string? name, bool hasWings, string? mouthpieceType, decimal bodySize, decimal mandibleSize, int numberOfSpots) : base(name, hasWings, mouthpieceType, bodySize, mandibleSize) { NumberOfSpots = numberOfSpots; } public Ladybug(Ladybug other) : base(other) { NumberOfSpots = other.NumberOfSpots; } public override void Assign(Insect other) { base.Assign(other); if (other is Ladybug ladybug) { NumberOfSpots = ladybug.NumberOfSpots; } } public override object Clone() => new Ladybug(this); }