How many types of access modifiers in c#?

Updated By: Alex Campos | 14 May 2019

V

Vinod Joshi

24 May 2019

We can use five types of access modifiers in the c# programming language. It is mentioned below:


  • Private 
  • Public
  • Protected
  • Internal
  • Protected Internal

Private - We can access private modifiers only inside the same class within an assembly.

Public - We can access public modifiers anywhere in an assemble and another assembly. E.g - Same, Derived, and Non-derived class.

Protected - We can use protected modifiers only in the Same & Derived class within an assembly, it is not accessible in Non-Derived class.

Internal - We can access internal modifiers in all class within an assembly. E.g.- Same, Derived, and Non-Derived class.

Protected Internal - It is the combination of internal and protected internal access modifiers.

1 votes

T

Tod J.

24 May 2019

There are five types of access modifiers in c#, but among of them three are most widely used, they are

Public, Private and Protected.

The work of Access Modifiers is only to decide the accessibility of variable, class or object that where they can be access and where they cannot be accessed.  

0 votes

Your Answer

Email Us: advertise@gdatamart.com

Legal Policy

International

© 2022 GDATAMART.COM (All Rights Reserved)