Friday, May 31, 2013

Internal Access Modifiers

Members declared with internal access modifiers can be accessed from within the same assembly in which the member is defined.  These members can also be accessed from other classes which reside in the same assembly.

The following example defines an internal variable
strInternalName.

    class BaseClass
    {
        private string strPrivateName;
        public string strPublicName;
        protected string strProtectedName;
        internal string strInternalName;
        protected internal string strProtectedInternalName;
    }
    //
    class ChildClass : BaseClass
    {
        public string strChildName;
    }

Notice that the internal variable is visible to the object of the class, since the class using the object is in the same assembly.



Search Flipkart Products:
Flipkart.com

No comments: