#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).

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: