This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Once the subclass-outside-the package inherits the protected member, that member becomes private to any code outside the class.
I am confused this point. Could any one explain me with one example?
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
Compiling this gives an error because the class ProtTest cannot access baseVar as pc.baseVar. baseVar is inherited by ProtChild, but outside of the class it is not visible. If you change the println as System.out.println( pc.method() ); then, there will be no error.