Which are the access modifiers available in C#?

C# Programming Language >   OOPS Concept >   Introduction to OOP Concept  

Short Question

539


Answer:

Following are the access modifiers generally used for accessibility:

  • Public: If you define an attribute or method as public, it can be accessed from any code of the project.
  • Private: A private defined attribute or method can be accessed by any code within the containing class only.
  • Protected: If you define the method or attribute as protected it can be accessed by any method in the inherited classes and any method within the same class.
  • Internal: If you define an attribute or a method as internal, it is restricted to classes within the current position assembly.
  • Protected internal: If you define an attribute or method as protected internal, access is restricted to classes within the current project assembly or types derived from the containing class.


This Particular section is dedicated to Question & Answer only. If you want learn more about C# Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.