โ Back to Inheritance
Question 526
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: 1200
Expected Output:
1200
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.