摘要: Despite the sufferring from the former disc04 ,i get the golden rule of extended classes' type discrmination ,that is , in a 赋值过程中,在类型层级上,右边的一定要小于左边的。 阅读全文
posted @ 2025-01-11 23:40 刘老六 阅读(27) 评论(0) 推荐(0)
摘要: extends(扩展) 和 override(重写) extends 关系导致的类型,子类一定是父类,父类一定不是子类。 就赋值而言, 父类 a= 子类 b 是 ok的 ;反过来 子类 x = 父类 y;是不ok的, 也就是说赋值时,类型层级上,右边一定是小于(低于)左边的。 给定 Animal 类 阅读全文
posted @ 2025-01-11 20:26 刘老六 阅读(25) 评论(0) 推荐(0)