wingman007

OOPClassesObjects2aProgram

Mar 17th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 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 World2a
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // 1. fields
  14.             // 2. setter and getter
  15.             //Person stoyan = new Person();
  16.             //stoyan.SetName("Stoyan");
  17.             //stoyan.SetAge(52);
  18.             //Console.WriteLine("My name is {0}. I am {1} years old!", stoyan.GetName(), stoyan.GetAge());
  19.             // 3. Properties
  20.             // 4. Auto Properties
  21.             Person stoyan = new Person();
  22.             // stoyan.Name = "Stoyan";
  23.             // stoyan.Age = 52;
  24.             // Console.WriteLine("My name is {0}. I am {1} years old! And my balance is {2}", stoyan.Name, stoyan.Age, stoyan.Balance);
  25.             stoyan.IntroduceYourSelf();
  26.  
  27.             //Person rosen = new Person();
  28.             //rosen.name = "Stoyan";
  29.             //rosen.age = 26;
  30.             //Console.WriteLine("My name is {0}. I am {1} years old!", rosen.name, rosen.age);
  31.             Person rosen = new Person("Rosen", 26, 123.45, "Stoyan", "Petko");
  32.             // Console.WriteLine("My name is {0}. I am {1} years old! And my balance is {2}.", rosen.Name, rosen.Age, rosen.Balance);
  33.             Console.WriteLine("And my first friend is {0}", rosen[1]);
  34.             rosen.IntroduceYourSelf();
  35.  
  36.         }
  37.     }
  38. }
Add Comment
Please, Sign In to add comment