wingman007

OOP2016FullTime3PrinciplesStudent

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