Tuesday, August 25, 2020

Access Modifiers

  •  In C# we have 5 access modifiers: 
    • Public
    • Private
    • Protected
    • Internal
    • Protected Internal
  • A class member declared with public is accessible everywhere. 
  • A class member declared with private is accessible only from inside the class.
  • A class member declared with protected is accessible for containing class and the derived types of the containing class. 
  • A class member declared with internal is accessible only for current assembly.
  • A class member declared with protected internal is accessible for current assembly and derived types of the containing class.

No comments:

Post a Comment