public static void Main() { //---------------------------------------------------------------------------------------------------- // Here we are creating object of derived class and accessing the property of base and derived class. //--------------------------------------------------------------------------------------------------- FullTimeEmployee FTE = new FullTimeEmployee(); FTE.FirstName = "John"; FTE.LastName = "Doe"; FTE.Email = "*****@*****.**"; FTE.YearlySalary = 500000; FTE.FullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.FirstName = "Jimmi"; PTE.LastName = "Suyang"; PTE.Email = "*****@*****.**"; PTE.HourlyPay = 10; PTE.FullName(); //---------------------------------------------------------------------------------------------------- // Note : Here in 'FullTimeEmployee' we cannot access property of 'PartTimeEmployee' as 'HourlyPay' // because it is specific to 'FullTimeEmployee' and Vice-Versa // Here we able to re-use the member of base class. //--------------------------------------------------------------------------------------------------- }
static void Main() { FullTimeEmployee FTE = new FullTimeEmployee(); FTE.Fname = "Suyog"; FTE.Lname = "Shelar"; FTE.FullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.Fname = "Suyog"; PTE.Lname = "Shelar"; PTE.FullName(); }