A Simpler Example: Hierarchy of Bank Accounts
- Consider a bank that offers its customers the following account types:
- Checking account: no interest; small number of free transactions per month, additional transactions are charged a small fee
- Savings account: earns interest that compounds monthly
- Inheritance hierarchy:

- All bank accounts support the getBalance method
- All bank accounts support the deposit and withdraw methods, but the implementations differ
- Checking account needs a method deductFees; savings account needs a method addInterest