In: Computer Science
How does polymorphism play a role in a system that pays a set of employees of various types?
We can define the abstract Employee class as Parent with all common attributes and define the required sub classes by extending Parent class by adding additional required fields and override the calculatePay method in all child class with required calculations; So here we are doing the method overriding so we can call parent class earnings method but at time it will call the child class version based on object it is pointing