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.
I understand that if a subclass is in a different package than its super it can't directly access any protected members, but instead gets its own inherited copy to deal with. The same should go for inner classes. However, the following code fails, and I can't seem to determine why. The commented out section of course would give a compiler error, it's p2 that I don't understand why it is giving an error also.
Any ideas? Jason
Chicken Farmer ()
Joined: May 08, 2001
Ok, I added a public no-argument constructor that does nothing to my inner class, and it compiles fine. Why? What is it about inner classes and constructors that made this fail? Does the default constructor get created with protected access also and therefore only accessible by subclasses of the inner class, or classes in the same package? Jason