anAccount.deposit(1000); // OK anAccount.addInterest(); // No--not a method of the class to which anAccount belongs
public void transfer(double amount, BankAccount other)
{
withdraw(amount);
other.deposit(amount);
}Can be used to transfer money from any type of BankAccount