子类重写父类的方法

 

学到了,如图

 

发现还是被重写了

 ------------------------------------------------------------------------------------

下面是老师给出的解释:

 super.before()
确认了调用father中的before方法

但是father中的before方法中有调用hello方法
而helle方法也是动态绑定的,所以调用时根据this实际应用的对象为son对象,所以调用的son中覆盖的hello方法 
posted @ 2018-04-03 20:04  SandV  阅读(248)  评论(0)    收藏  举报