Write a program to read the following hierarchy. Employee is derived into PermanentEmployees and DailyEmployees. PermanentEmployees are derived into DepartmentalEmployees and CompanyEmployees. CompanyEmployees are derived into RegionalManagers and AreaManagers. DepartmentalEmployees are derived into Sales, Production, and HumanResource employees. Defi ne a single array for storing all employee objects. Defi ne a function Salary, which displays the salary (do not calculate salary; just display any value) of permanent employees alone. Use dynamic_cast to solve the problem. ( Hint: we cannot use virtual functions defi ned in the Employee class here as DailyEmployees do not have salary functions defi ned. We have to defi ne salary as a virtual function in the class PermanentEmployees. We have to use Employee pointer to access the objects. Whenever it is valid to cast from Employee to PermanentEmployees, the object belongs to any of the descendants of PermanentEmployees class. dynamic_cast helps us to fi nd this.)
#Sales Offer!| Get upto 25% Off: