← Back to Inheritance
Question 616
Salary With Bonus
Salary With Bonus
Combine constructor chaining, an override, andbase.EmployeestoresbaseSalaryand has avirtual int Pay()returningbaseSalary. CreateManager : Employeewith a constructor(int baseSalary, int bonus)that passesbaseSalaryto the base and storesbonus, and overridePay()to returnbase.Pay() + bonus. Do NOT write aMainmethod. When the tester createsManager(1000, 200)and printsPay(), the program prints the output shown in Expected Output.
Expected Output:
1200= newline. The output ends with a newline — print one after the last line.
Hints4 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 (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.