Lecture 10
20
Bank and BankAccount cooperate
•
public int deposit(int amount)
•
{
•
this.
incrementBalance( amount);
•
this.
countTransaction();
•
return amount ;
•
}
•
public void incrementBalance(int amount)
•
{
•
balance += amount;
•
this.
getIssuingBank().
incrementBalance( amount );
•
}
this BankAccount asks the Bank it is in to update
its own balance field