Advertisement
wingman007

C#_OOP_Inheritance_Athlete.cs

May 1st, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 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 App1
  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("DeafultAthlete", 0, "sport")
  21.         { }
  22.  
  23.         public Athlete(string name, int age, string sport)
  24.             : base(name, age)
  25.         {
  26.             this.sport = sport;
  27.         }
  28.  
  29.         public void DisplaySport()
  30.         {
  31.             Console.WriteLine("My sport is {0}", sport);
  32.         }
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement