#307 – Internal Class Members

Class members marked with the accessibility keyword internal are accessible from within the same class, or from within the code of any classes that exist in the same assembly.

In the picture below, the Dog.DoBark method is marked as internal.  The code in any of the blue blocks can call this method.

Notice that code in the Shepherd class cannot call DoBark, even though it’s in a subclass of Dog.  Also notice that code in OtherClass can call DoBark, even though it’s not a subclass of Dog.  Only code in the same assembly as the Dog class has access to the DoBark method.

Advertisements