I'm not sure these are benfits, but more why and how you should use nested
classes:
1) It's accesible only through the containing class.
2) If the class is only meaningful to one other class, why not nest it
within this other class, thus indicating to other developers the exact use
of the class.
It's a matter of encapsulation. It allows you to create private utility
classes that are only visible to the containing class.
One more note, though -
I've seen a few people call these sub-classes or subclasses, but the real
name is "nested class". Subclasses are classes that inherit from another
base class (or superclass).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.