Advertisement
wingman007

OOP_20151b_Inheritance_Program

Mar 21st, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.75 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 Person1b
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // int counter = 0;
  14.             Person person1 = new Person("Stoyan", 50);
  15.             // counter++;
  16.             Person person2 = new Person(20, "Valya");
  17.             // counter++;
  18.             Person person3 = new Person();
  19.             // counter++;
  20.  
  21.             // person1.Name = "Stoyan";
  22.             // person1.Age = 50;
  23.  
  24.             // person2.Name = "Valya";
  25.             // person2.Age = 20;
  26.  
  27.             // Console.WriteLine("My name is {0}!. I am {1} years old!", person1.Name, person1.Age);
  28.             // Console.WriteLine("My name is {0}!. I am {1} years old!", person2.Name, person2.Age);
  29.             // Console.WriteLine("My name is {0}!. I am {1} years old!", person3.Name, person3.Age);
  30.  
  31.             Person.nationality = "German";
  32.  
  33.             person1.IntroduceYourSelf();
  34.             person2.IntroduceYourSelf();
  35.             person3.IntroduceYourSelf();
  36.  
  37.             // Console.WriteLine("The population is {0}", counter);
  38.  
  39.             Person student1 = new Student("Kircho", 25, 123456);
  40.  
  41.             student1.IntroduceYourSelf();
  42.  
  43.             // Console.WriteLine(student1);
  44.  
  45.             Athlete athlete1 = new Athlete("Krisi", 25, "box");
  46.  
  47.             athlete1.IntroduceYourSelf();
  48.  
  49.             // Executor exec1 = new Executor((Student)student1);
  50.             Executor exec1 = new Executor(student1);
  51.             exec1.MakeHimSpeak();
  52.  
  53.             Console.WriteLine("The population is {0}", Person.counter);
  54.  
  55.             Console.WriteLine("Hello!");
  56.             Console.Read();
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement