โ Back to Inheritance
Question 129
Is-A Relationship
Is-A Relationship
A base class Account has been provided with a protected double balance, a constructor, and a getBalance() function. A derived class SavingsAccount publicly inherits from Account and has an additional double interestRate. The constructor has already been implemented. Your task is to implement the calculateInterest() function. It should return balance * interestRate. Do NOT include a main function. Your code will be tested automatically. Expected output: Interest: 50
Expected Output:
Interest: 50
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.