Visual Explanation of Access Specifiers in OOPs

Access specifiers  (or access modifiers) are keywords in object-oriented languages that set the accessibility of classes, methods, and other members. Access modifiers are a specific part of programming language syntax used to facilitate the encapsulation of components.

There are 5 access modifiers.

  1. Private: Accessible only within the class.
  2. Protected: Accessible within the class and its derived classes.
  3. Internal: Accessible anywhere within the current project or assembly.
  4. Protected internal: Accessible with current project and derived classes.
  5. Public: Accessible everywhere.
Access specifier
Access specifier