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.
- Private: Accessible only within the class.
- Protected: Accessible within the class and its derived classes.
- Internal: Accessible anywhere within the current project or assembly.
- Protected internal: Accessible with current project and derived classes.
- Public: Accessible everywhere.