Access specifiers define the visibility and accessibility of classes, methods, properties, fields, and other members within a program or project.
They control where members can be accessed.
public
Accessible from anywhere within the same assembly or another assembly.private
Accessible only within the same class.
Note:- Default access modifiers for class members.protected
Accessible within the same class and derived classes(means inherited classes)internal
Accessible only within the assembly (project) but not outside the assembly or project.
Note:- Default for classes and structures(structs).protected internal
Accessible within the same assembly/project, likeinternal
or in a derived class in another assembly/project, likeprotected
Top comments (0)