Lecture 16
15
Polymorphism
•     atm.println(" withdrew " +          acct.withdraw( amount ));
•Checking and Regular accounts just do it
•FeeAccount charges a fee
•SavingsAccount keeps track of transactions in this month
•No casting, since BankAccount has a  withdraw method
•Polymorphism is in countTransaction, invoked by withdraw
This is another example of polymorphism – a little more subtle since the withdraw method is actually in the parent BankAccount class, unlike the abstract newMonth method. The polymorphism comes in when withdraw sends the countTransaction method, which some child classes override. The Bank doesn’t know or care.