English 中文(简体)
标签:的问答
如果我把一个子类当作它的超级类, 并称之为一种在子类中被压倒的方法, 它是执行被压倒的还是原始的方法?
原文:If I ve cast a subclass as its superclass, and call a method that was overridden in the subclass, does it perform the overridden or original method?

考虑: 狗是动物的子类, 狗取代动物。eat () 动物[] 动物 = AllAnimals (); 对于 (i = 0; i < 动物. 长度; i++) { 动物[i].eat (); } 如果动物.eat () 是...

热门标签