Friday, May 31, 2013

What are Access Modifiers?

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
Private
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;
}



Search Flipkart Products:
Flipkart.com

No comments: