Polymorphic Salary Calculation
hardQuestion 292The base class Employee has a totalPay() method that returns baseSalary plus the result of the VIRTUAL method bonus() (which returns 0 by default). Complete the derived class Manager so it overrides bonus() to return 1000.
The key idea: totalPay() lives in the base class but calls the overridden bonus() at runtime. The provided main proves this by calling totalPay() on a Manager through an Employee pointer.
Expected output
6000= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
Inheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.