Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ClassLibrary
- {
- public class Bird : Animal
- {
- private int _speed;
- public int Speed
- {
- get => _speed;
- set
- {
- if (value > 0 && value <= 100)
- _speed = value;
- else throw new ArgumentOutOfRangeException();
- }
- }
- private Bird() { }
- public Bird(string name, bool isTakingCare, int speed) : base(name, isTakingCare)
- {
- Speed = speed;
- }
- public override string ToString()
- {
- return base.ToString() + $", Speed = {Speed}";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement