Python – Object Oriented Programming – Design Inheritance & Properties

Best Practices Designing for Inheritance and Polymorphism Polymorphism   Interface # Withdraw amount from each account in list_of_accounts def batch_withdraw(list_of_accounts, amount): for acct in list_of_accounts: acct.withdraw(amount) b, c, s = BankAccount(1000), CheckingAccount(2000), SavingsAccount(3000) batch_withdraw([b,c,s]) # uses bankaccount.withdraw, checking, Savings batch_withdraw() doesn’t need to check the object to know which withdraw() to call Liskov substitution principle […]