Q:

Why use access modifiers?

0

Why use access modifiers?

All Answers

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

Access modifiers are an integral part of object-oriented programming. Access modifiers are used to implement the encapsulation of OOP. Access modifiers allow you to define who does or who doesn’t have access to certain features.
 
There are 6 different types of Access Modifiers in C#:
 
Modifier Description
public There are no restrictions on accessing public members.
private Access is limited to within the class definition. This is the default access modifier type if none is formally specified
protected Access is limited to within the class definition and any class that inherits from the class
internal Access is limited exclusively to classes defined within the current project assembly
protected internal Access is limited to the current assembly and types derived from the containing class. All members in the current project and all members in derived class can access the variables.
private protected Access is limited to the containing class or types derived from the containing class within the current assembly.

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

total answers (1)

Similar questions


need a help?


find thousands of online teachers now