The access modifier is used to specify the accessibility of class members. The C # access modifiers include private, protected, public, and internal.
Private declares Private Members. Private Data members can only be used and modified by functions in the class. Private function members can only be called by functions in the class. Although the derived classes inherit the Private Members of the base class, they cannot be accessed directly and can only be accessed through the public members of the base class.
Protected declares to protect members. To protect data members, they can only be used and modified by functions inside the class and derived classes. To protect function members, they can only be called by functions inside the class and derived classes.
Public declares public members. The public function members of a class can be called by external programs of the class, and the public data members of the class can be directly used by external programs of the class. A public function is actually an interface for communication between a class and an external function. by calling a public function, an external function modifies the private and protected members of a class in a preset way.
Internal declares that internal members can only be accessed in files in the same Assembly. They are generally the same application or library ).