package savings;

import bank.Account;

// No compila: desde otro paquete, una subclase usa el campo protegido de su
// propio tipo (this, otro Savings), pero no el de un Account cualquiera.
public class Savings extends Account {
    void addInterest() {
        balance += balance / 100;   // bien: es this.balance
    }

    void copyFrom(Savings other) {
        balance = other.balance;    // bien: other es un Savings
    }

    void drain(Account other) {
        other.balance = 0;          // error: other puede ser cualquier Account
    }
}
