Nested Classes, Part 1
Subject:   Accessing Protected Members
Date:   2004-05-18 21:28:10
From:   bdell
Response to: Accessing Protected Members

I placed BasicMonitorScreen in package package1 and ColorMonitorScreen in package package2 and it still compiles. I also tried 1.4.2 and it works there as well. Perhaps I am misunderstanding what the "other" class is.

Given the way inner classes are implemented, it seems natural to provide access as the accessor method the inner class depends on would have access to protected members of the enclosing class's super-class and, as I wrote before, it seems consistent with the definition of protected access. I couldn't find anything in the Java Language Specification that said protected members in this circumstance shouldn't be accessible.

1 to 1 of 1
1 to 1 of 1