Advertisement
svetoslavhl

Athlete.cs

Apr 16th, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 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 OOP3
  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(string name, int age, string sport)
  20. : base(name, age)
  21. {
  22. this.sport = sport;
  23. }
  24.  
  25. // In case we are using the interface to upcast we get the old method from Human not this one
  26. // public new void introduceYourSelf()
  27. // {
  28. // Console.WriteLine("My name is {0}. And I am {1} years old! I am {2}.I am practicing {3}.", name, age, nationality, sport);
  29. // }
  30.  
  31. public override void introduceYourSelf()
  32. {
  33. Console.WriteLine("I am an athlete. My name is {0}. And I am {1} years old! I am {2}.I am practicing {3}.", name, age, nationality, sport);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement