When you make a nested class private
, it means that the class is part of the implementation detail of your main class. That is, your main class has the public methods that it needs to provide, and in order to provide those, the programmer has decided to define another class to help with the implementation (for example, to hold some kind of table of data that the public methods use). (Sometimes this means that the class is getting too big and complicated, and that some refactoring is in order. But that's a matter for another question.)
In any case, if you want classes that use BinaryTree<T>
to be able to use Node<T>
, that's an indication that Node<T>
is an important part of the purpose of the BinaryTree
class (as it appears to clients), and not merely an implementation detail. That means it probably shouldn't be private
.