โ Back to Inheritance
Question 507
Account Protected Balance
Account Protected Balance
The base classAccounthas aprotectedfieldbalanceset by its constructor. Because it isprotected, the derived classSavingscan access it. CompleteShow()inSavingsto printBalance:followed by thebalancevalue. Do NOT write aMainmethod. When the tester creates aSavingswithbalance = 100and callsShow(), the program prints: Balance: 100
Expected Output:
Balance: 100
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.