正在加载图片...
Example:Bank Accounts A class serves as a blueprint for its instances Tiff's Idea:All bank accounts have a balance Account and an account holder; the Account class should define those values for each newly created instance. Withdraw S5 Idea:All bank accounts should have Transfer $5 "withdraw"and "deposit"behaviors that all work in the same way. Alex's Better Idea:All bank accounts share a Account "withdraw"and "deposit"method. Deposit $5 All accounts might also share other characteristics like maximum withdrawal, or loan limits.Example: Bank Accounts Tiff’s Account Alex's Account Deposit $5 Withdraw $5 Transfer $5 A class serves as a blueprint for its instances Idea: All bank accounts have a balance and an account holder; the Account class should define those values for each newly created instance. Idea: All bank accounts should have “withdraw” and “deposit” behaviors that all work in the same way. Better Idea: All bank accounts share a “withdraw” and “deposit” method. All accounts might also share other characteristics like maximum withdrawal, or loan limits
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有