Author Topic: Difference between Protected and Internal  (Read 9332 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
Difference between Protected and Internal
« on: February 14, 2009, 12:17:57 AM »
Protected:
A protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declared this member.

Internal:
Internal types or members are accessible only within files in the same assembly.

This means that a "procted internal" member (combination of these two) will be visible only to classes that derive from the class that declares that member *and* are declared in a file in the same assembly.

'protected internal' does not mean protected *and* internal - it means protected *or* internal.  So a protected internal member is visible to any class inheriting the base class, whether it's in the same assembly or not.  The member is also visible via an object declared of that type anywhere in the original assembly.