《introduction t information systems》3.ppt

《introduction t information systems》3

* * * * * * * * * * 上面例子中BankAccount的两个子类(兄弟类)CheckingAccount和SavingsAccount具有同名方法toString A method is overridden when the parent class method signature is maintained but the implementation changes. A methods signature includes its name and its parameter list. 如果子类和父类具有同名方法,则将这种情况称为对方法的重写. 即子类改写了父类的同名方法 Overriding Methods If the number of checks written exceeds a set threshold (ten for example) then a one-dollar fee is charged for each withdrawal. How to do this? 如果支票数量超过了10, 那么每次取钱需要收1元. This may be implemented by overriding the withdraw method in the CheckingAccount class. Example /* Ba

文档评论(0)

1亿VIP精品文档

相关文档