Access Modifiers are basically used to control the accessibility of types and members with in the types. In C# there are 5 different types of Access Modifiers.
1. Public: Public is the most common access specifier in C#. It can be accessed from anywhere, that means there is no restriction on accessibility. It is accessible to all classes & projects.
2. Private: The range of the accessibility is limited only within the classes or struct in which they are declared.
3. Protected: All members in the current class & in derived classes can access the variables.
4. Internal: The type or member can be accessed by any code in the same assembly, but not from another assembly.
5. Protected Internal: The protected internal access specifier allows a class to hide its member functions & member variables from other class objects and functions, except a child class within the same application. This is also used while implementing inheritance.
Access Modifiers are basically used to control the accessibility of types and members with in the types. In C# there are 5 different types of Access Modifiers.
1. Public: Public is the most common access specifier in C#. It can be accessed from anywhere, that means there is no restriction on accessibility. It is accessible to all classes & projects.
2. Private: The range of the accessibility is limited only within the classes or struct in which they are declared.
3. Protected: All members in the current class & in derived classes can access the variables.
4. Internal: The type or member can be accessed by any code in the same assembly, but not from another assembly.
5. Protected Internal: The protected internal access specifier allows a class to hide its member functions & member variables from other class objects and functions, except a child class within the same application. This is also used while implementing inheritance.
need an explanation for this answer? contact us directly to get an explanation for this answer