Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Are nested classes the only way to restrict class access to one class?

To store data I read from an XML file, i have created a data structure as displayed in the picture above. All boxes with a numbering 1 to n are instances of a class.

First question:

Each class that can hold multiple instances of other classes does so with a list<class> element (e.g. FundamentalNamingConvention stores many UnitTypes in a List<UnitType>). Is this a proper way of doing it?

Second question:

All classes (FundamentalNamingConvention, UnitType, UnitName) are only to be accessed by the NameGenerator class. To ensure this, I could simply make all these classes be inner classes of the NameGenerator but then that file would be several hundred lines of code long.

Is there a way to have the classes stored in their separate files (e.g. UnitType.cs) but still only be accessible by the NameGenerator?

Sign In or Register to comment.