wingman007

2015_OOP_Inheritance_Program

Apr 29th, 2015
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.35 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 Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("My PI = {0}", Person.PI);
  14.             Console.WriteLine("Only for read = {0}", Person.onlyRead);
  15.  
  16.             // int counter = 0;
  17.             Person person1 = new Person("Stoyan");
  18.             // person1.Name = "Stoyan";
  19.             // person1.Age = 51;
  20.             // counter++;
  21.  
  22.             Person person2 = new Person(20, "Mario", "Bobi", "Kristian", "Stoyan", "Anton");
  23.             // person2.Name = "Mario";
  24.             // person2.Age = 20;
  25.             // counter++;
  26.  
  27.             Person person3 = new Person();
  28.             // counter++;
  29.  
  30.             IncreasPopulation();
  31.  
  32.             person1.IntroduceYourSelf();
  33.             person2.IntroduceYourSelf();
  34.             person3.IntroduceYourSelf();
  35.  
  36.             Person.Nationality = "German";
  37.  
  38.             person1.IntroduceYourSelf();
  39.             person2.IntroduceYourSelf();
  40.             person3.IntroduceYourSelf();
  41.  
  42.             // Console.WriteLine("The population of my kingdom is {0}", counter);
  43.  
  44.             Console.WriteLine("The population of my kingdom is {0}", Person.Counter);
  45.  
  46.             Console.WriteLine("National Income = {0}", Person.GetNationalIncome());
  47.  
  48.             Person student1 = new Student("Kircho", 25, "4314324234");
  49.             student1.IntroduceYourSelf();
  50.  
  51.             Student student2 = new Student();
  52.  
  53.             Athlete athlete1 = new Athlete("Krisi", 25, "box");
  54.             athlete1.IntroduceYourSelf();
  55.  
  56.             Executor exec = new Executor(student1);
  57.             exec.MakeHimSpeak();
  58.  
  59.             Console.WriteLine(student1); // .ToString()
  60.  
  61.  
  62.             /*
  63.             Console.WriteLine("My name is {0}! I am {1} years old! My balance is {2}",
  64.                 person1.Name, person1.Age, person1.Balance);
  65.  
  66.             Console.WriteLine("My name is {0}! I am {1} years old!",
  67.                 person2.Name, person2.Age);
  68.  
  69.             Console.WriteLine("My name is {0}! I am {1} years old!",
  70.                 person3.Name, person3.Age);
  71.             */
  72.         }
  73.  
  74.         private static void IncreasPopulation()
  75.         {
  76.             Person person1 = new Person("Petko", 15);
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment