This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
U R right Richard...
Posted by Kishori Sharan on January 30, 2001 at 3:30 PM
Hi Richard It is always better to use super in such a case. I had just given an example of how to access i in class B and how to get i from its ancestor. You are right , one should use super to access i from A. I just wanted to show that it is the type of object refernece that matter in case of name hiding. If you are using super keyword then there is no ambiguity at all. Thanx Kishori
Replies:
|