SHARE
TWEET

Untitled

a guest Jun 17th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ClassLibrary
  8. {
  9.     public class Bird : Animal
  10.     {
  11.         private int _speed;
  12.  
  13.         public int Speed
  14.         {
  15.             get => _speed;
  16.             set
  17.             {
  18.                 if (value > 0 && value <= 100)
  19.                     _speed = value;
  20.                 else throw new ArgumentOutOfRangeException();
  21.             }
  22.         }
  23.  
  24.         private Bird() { }
  25.  
  26.         public Bird(string name, bool isTakingCare, int speed) : base(name, isTakingCare)
  27.         {
  28.             Speed = speed;
  29.         }
  30.  
  31.         public override string ToString()
  32.         {
  33.             return base.ToString() + $", Speed = {Speed}";
  34.         }
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top