0

I have 3 classes. BankAccount, InterestAccount and IsaAccount. InterestAccount extends BankAccount. IsaAccount extends InterestAccount.

This is what I have got for BankAccount for the withdraw method.

public void withdraw(int amount) {
    balance = balance - amount;
}

This is what I have got in InterestAccount for the withdraw method. (minimumBalance is the amount belof which balance should not fall but don't worry about it)

public void withdraw(int amount) {
    if (super.getBalance() - amount >= minimumBalance) {
        super.withdraw(amount);
    }
}

The question is what should I do to make a withdraw class for IsaAccount which kind of "extends twice"? I know super.super.balance isn't the case. What's the right way to do it?

Lazio
  • 105
  • 1
  • 10

0 Answers0