Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner classes

 
Marc Shiest
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey my fellow Java Ranchers...what is the difference between a private inner class and a protected inner class?
Thanx
 
Mikael Jonasson
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same as the difference between a private and a protected member variable: The acces to it.
If you declare an inner class to be private, the only methods that can acces methods within that class are methods of the class encapseling that class. If you use protected, subclasses of the encapusing class may access it.
/Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic