Advertisement
wingman007

C#_OOP_Enum_NestedClass_Generics_Athlete

May 27th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace App2b
  8. {
  9.     class Athlete : Human
  10.     {
  11.         private string sport;
  12.  
  13.         public string Sport
  14.         {
  15.             get { return sport; }
  16.             set { sport = value; }
  17.         }
  18.  
  19.         public Athlete()
  20.             : this("DeafaultAthlete", 0, "sport")
  21.         { }
  22.  
  23.         public Athlete(string name, int age, string sport)
  24.             : base(name, age, Human.BrainSize.Normal)
  25.         {
  26.             this.sport = sport;
  27.         }
  28.  
  29.         public void DisplaySport()
  30.         {
  31.             Console.WriteLine("My sport is {0}", sport);
  32.         }
  33.  
  34.         public override void IntroduceYourSelf()
  35.         {
  36.             base.IntroduceYourSelf();
  37.             Console.WriteLine("My sport is {0}", sport);
  38.         }        
  39.  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement