Access
modifiers are keywords which are used to define the scope / accessibility of class
members. Access modifier keywords should be added in front of the variable or
function to define its scope.
The following are the 4 access modifiers available in C# .Net
PrivateThe following are the 4 access modifiers available in C# .Net
Public
Protected
Internal
The following example contains a class which declared one variable based on each of the access modifiers.
class BaseClass
{
private string
strPrivateName;
public string
strPublicName;
protected string
strProtectedName;
internal string
strInternalName;
}
No comments:
Post a Comment