previous |
start |
next
Invoking a Superclass Method
- Can't just call
deposit(amount)
in deposit method of CheckingAccount
- That is the same as
this.deposit(amount)
- Calls the same method (infinite recursion)
- Instead, invoke superclass method
super.deposit(amount)
- Now calls deposit method of BankAccount
class
- Complete method:
public void deposit(double amount)
{
transactionCount++;
super.deposit(amount);
}
previous |
start |
next