UML Class Diagram
BankAccount
- balance: int
+ __init__()
+ deposit(amt)
+ withdraw(amt)
Create a BankAccount class with deposit() and withdraw() methods that modify the account balance.
The object remembers balance. deposit(amount) updates it.
A class can have many methods that work together. Each method modifies or queries the object's state (stored in self).
Banks model accounts as objects with balance, deposit(), withdraw(), and transfer() methods. Games use Character objects with move(), attack(), heal(). UI uses Button objects with click(), hide(), show().