static void Main() { //Constructor example ConstructorDemo customer = new ConstructorDemo("Harika", "Sandilya"); customer.PrintFullName(); //StaticReferenceMembersDemo StaticReferenceMembersDemo obj1 = new StaticReferenceMembersDemo(5); float area1 = obj1.CircleArea();//pi is static, radius is instance type Console.WriteLine("Ares is :" + area1); StaticReferenceMembersDemo obj2 = new StaticReferenceMembersDemo(5); float area2 = obj2.CircleArea(); Console.WriteLine("Ares is :" + area2); //Inheritance FullTimeEmployee fullTime = new FullTimeEmployee(); fullTime.firstName = "Harika"; fullTime.salary = 1000000; PartTimeEmployee partTime = new PartTimeEmployee(); partTime.firstName = "part time"; partTime.partTimeSalary = 300000; //calling base class method from child class object //((InheritanceDemo)partTime).PrintFullName(); // creating obj of parent class //InheritanceDemo partTime2 = new PartTimeEmployee(); //partTime2.PrintFullName(); //PolyMorphism PolyMorphismDemo[] polyMorphism = new PolyMorphismDemo[3]; polyMorphism[0] = new SeniorEmployee(); polyMorphism[1] = new JuniorEmployee(); polyMorphism[2] = new PolyMorphismDemo(); foreach (PolyMorphismDemo item in polyMorphism) { Console.WriteLine("FIRST AND LAST NAMES:"); } }
// 진입점 static void Main() { ConstructorDemo c = new ConstructorDemo(); }