Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inheritance and private variables?

807588Jul 20 2009 — edited Jul 22 2009
Recently, I submit a feedback to the Java Specification Language, because there is an ambiguos definition concern with Inheritance and declaration of private fields in it. Specifically in 6.6.8 Paragraph, The Java Specification Language says that a superclass does not inherit private fields to its subclasses.

I received an answer from 'somebody' whom only tells me that: ¡"The Java Specification Language was right +per se+ and he was unable to discuss the matter. " ! (Quotes and Exclamation marks are mine)

However I found a forum answer in http://forums.sun.com/thread.jspa?forumID=1&threadID=258864

where rhasselbaum says: "Also, private data members are inherited by subclasses. That is, memory is allocated for the data members when a subclass object is created and their values can be changed by methods that are allowed to access them."

Another person: andrew_malcolm in same forum says: "Private data members are inherited by derived classes, but may still only be accessed via accessor functions (if provided):"

Finally in same forum a third person: [Dukes Earned 41] wheaton84 says: "armalcolm is right. The key word is implementation... ,good explanation armalcolm. "

I would like that the Java Specification Language could be corrected from this ambiguity.

Is thera somebody whom knows to rhasselbaum or andrew_malcolm or wheaton84?

I think that they could help me with this topic and eventualy reach the correction, because it avoid many discussions on the web like the following:

http://www.velocityreviews.com/forums/t130343-question-about-inheritance-of-private-variables.html

I would appreciate any feedback to respect.

thanks a lot.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2009
Added on Jul 20 2009
25 comments
451 views