Originally posted by Roel De Nijs:
just like declaring a variable inside a method would hide a field of the same name declared outside of the method = shadowing
and is hiding and shadowing synonyms?
Originally posted by Amar Shrivastava:
The error is beacuse class D extend C and inherits all members except which are private, final,overridden or hidden.
Originally posted by Amar Shrivastava:
Layne, I suppose that here in this example it is the modifier private in class C which is the main culprit for the error in class D.
This field in C is hiding the superclass field and so not inheritting it,
and since it is private it is not letting class D to inherit this field.
Originally posted by Roel De Nijs:
Layne,
I did what you said, so changing the access modifier of member in class C and then checking in class D of member is visible or not. this are the results:
- private --> not visible
- default --> not visible (class D was in other package than class C)
- protected --> visible
- public --> visible
so that isn't prooving the point you made
Consider Paul's rocket mass heater. |