wingman007

OOP4BeginnersStudent

Mar 25th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 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 Student : Person
  10.     {
  11.         // public string FNumber { get; set; }
  12.         private string fNumber;
  13.  
  14.         public string FNumber
  15.         {
  16.             get { return fNumber; }
  17.             set { fNumber = value; }
  18.         }
  19.  
  20.         public Student()
  21.             :this("Default", 0, "")
  22.         { }
  23.  
  24.         public Student(string name, int age, string fNumber)
  25.             :base(name, age)
  26.         {
  27.             this.fNumber = fNumber;
  28.         }
  29.  
  30.         public override void IntroduceYourSelf()
  31.         {
  32.             Console.WriteLine("I am student!");
  33.             base.IntroduceYourSelf();
  34.             Console.WriteLine("My fNumber = {0}", fNumber);
  35.         }
  36.  
  37.     }
  38. }
Add Comment
Please, Sign In to add comment