wingman007

2015_OOP_AbstractionEncapsulationPolymorphism_Athlete

May 20th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 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 World1
  8. {
  9.     class Athlete : Person
  10.     {
  11.         private string sport;
  12.  
  13.         public string Sport
  14.         {
  15.             get { return sport; }
  16.             set { sport = value; }
  17.         }
  18.  
  19.         public Athlete(string name, int age, string sport)
  20.             : base(name, age)
  21.         {
  22.             this.sport = sport;
  23.         }
  24.  
  25.         public override void IntroduceYourSelf()
  26.         {
  27.             base.IntroduceYourSelf();
  28.             Console.WriteLine("My sport is {0}", sport);
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment