Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OOP3
- {
- class Athlete : Human
- {
- private string sport;
- public string Sport
- {
- get { return sport; }
- set { sport = value; }
- }
- public Athlete(string name, int age, string sport)
- : base(name, age)
- {
- this.sport = sport;
- }
- // In case we are using the interface to upcast we get the old method from Human not this one
- // public new void introduceYourSelf()
- // {
- // Console.WriteLine("My name is {0}. And I am {1} years old! I am {2}.I am practicing {3}.", name, age, nationality, sport);
- // }
- public override void introduceYourSelf()
- {
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement