Any private member (field, method, nested classes) is only accessible from code inside the very same class.
Now class B also has a field "i" that has default (package) visibility, so that should be visible. The thing is, unlike methods, fields are not polymorphic - it uses the reference type (in this case A), not the actual type (in this case B).
Fred Hamilton wrote:Duly noted. In light of that, I'm not sure what you meant earlier by fields not being polymorphic, but I'll do the research and find out.
What I meant is that for fields, the reference type (A) is what determines from which class the field is actually accessed. With methods on the other hand, it's the actual runtime type (B) that determines from which class the method is actually accessed.
Joined: Jan 07, 2008
Thanks everybody..... That clarify my doubt.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com