What are Access Modifiers/Specifiers in C#
11 Mar 2014, 05:25 AM
Access Modifiers defines the scope of the member or type. The keywords used to specify the declared accessibility of a member or a type. There are 5 types of access modifiers that can be used in c#
- public
It specifies that everyone can access the member or type. It can be access from the anywhere even from the outside the namespace.
- protected
It specifies that only containing class and child class can access it. It becomes very important while implementing inheritance.
- internal
It specifies that the class and member can be access only with in the same assembly.
- protected internal
It specifies that the access is limited to the current assembly or the child class that is derived from the containing class.
- private
It specifies that the only containing type can access it.