#624 – Accessibility of a Nested Class

When you define one class within the scope of another (a nested class), you have several choices for the accessibility of the inner class.  The inner class can be defined with any of the following access modifiers:

  • public – the class is accessible from any code, within the assembly where it’s defined or from a different assembly
  • protected internal – class accessible from any subclass of the outer class or from any code within the same assembly
  • protected – class accessible from any subclass of the outer class
  • internal – class accessible from any code within the same assembly
  • private – class accessible only from within the outer class

Notice that the choices for accessibility of a nested class are much broader than for a class defined in a standard namespace scope (public, internal).

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a comment