How many types of access modifiers in c#?

Query By: ALEX CAMPOS

V

Vinod Joshi

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.

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

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)