Different access modifiers in C#?

There are four access modifiers in C# which can control the access over the class members and functionalities as a part of data Encapsulation. They are:

  • public - accessible for all classes
  • private - Only accessible within the same class
  • protected - accessible within the same class, or in a class that is inherited from that class.
  • internal - only accessible within its own namespace, but not from another namespace.

C# Concepts Posted May 14, 2021

You can now show your support. 😊

We use cookies to provide you with a great user experience, analyze traffic and serve targeted promotions.   Learn More   Accept