Q:

What are Access Modifiers in C#?

0

What are Access Modifiers in C#?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

total answers (1)

Top 100 C# interview questions and answers 2022

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How is the exception handling done in C#?... >>
<< Why we use keyword “const” in C#....