为什么子类的超类赋值会产生错误?

时间:2013-03-02 04:43:55

标签: java oop inheritance superclass

有人可以解释为什么会出错吗? - 基于Java中实现的方式

1 个答案:

答案 0 :(得分:6)

因为所有的猫都是哺乳动物,但并非所有的哺乳动物都是猫。

请参阅the Inheritance lesson of the Java Tutorial.

中标题为“投射对象”的部分
相关问题