本文介绍了如何使用超级超类的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中,我遇到一种情况:我写了3个类A,B,C,类B扩展了类A,而类C扩展了类B.
类A中有一个方法X(),然后我在类B中重写并再次在类C中重写.
现在声明一个类型为C的变量M.如何调用M.X(),其中X()属于类A.

确实需要帮助:)

我在Java中使用JDK 1.6.0

In java, I have a situation : I wrote 3 classes A, B, C, class B extends class A and class C extends class B.
There is a method X() in class A, then I override in class B and override in class C, again.
Now declare a variable M type C. How could I call M.X() in which X() is belonged to class A.

Really need help :)

I code in java, using JDK 1.6.0

推荐答案



这篇关于如何使用超级超类的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 17:30