static void Main(string[] args) { //var payroll = new PayRoll(); var employee1 = new PermaEmployee(); var employee2 = new TempEmployee(); ////////////////Below code not working/////////////////why??/////////////// //payroll.employees[0] = employee1; //payroll.employees[1] = employee2; //for (int i = 0; i < payroll.employees.Length; i++) //{ // Console.WriteLine("Salary of {0} employee: {1}", payroll.employees[i].name,payroll.employees[i].CalculateSalary()); //} Console.WriteLine("Salary of {0} employee: {1}", employee1.name, employee1.CalculateSalary()); Console.WriteLine("Salary of {0} employee: {1}", employee2.name, employee2.CalculateSalary()); }