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.
On the Marcus Green exam #2, question 57, he asks if the following is true: "Under no circumstances can a class be defined with the private modifier" His answer is that the above statement is false. Now, I know that top-level classes can't be private or protected, so that's not my question. What I am confused about is this: when you see the word "class" (without mention of inner, nested, or anonymous), does that always mean top-level classes, only?? I'm taking the exam tomorrow, so I worry about such things.
Dab, no, i think mention of "class" does not guarantee it to be a top level class. for example, there may be a case of subclassing a class with "default" access. in this case, compiler would require us to declare the extending class to be either "protected" or "private". did i get you correctly? HTH
Joined: Nov 22, 2008
HTH, I was meaning top-level versus nested, inner, or anonymous; I wasn't meaning superclass versus subclasses. A top-level (i.e., not an inner...) can only have default or public access. But inner and nested classes can be have public, protected, default, or private access. I'll just take the lone word "class" in context the best that I an on the exam!