overriding protected internal with protected!

Posted by Asad Butt on Stack Overflow See other posts from Stack Overflow or by Asad Butt
Published on 2010-03-03T23:20:24Z Indexed on 2010/05/24 4:31 UTC
Read the original article Hit count: 325

This is an extension for this question asked an hour ago.

We cannot modify the access modifiers, when overriding a virtual method in derived class. Consider Control class in System.Web.UI namespace

public class Control : IComponent, IDisposable,...
{ 
   protected internal virtual void CreateChildControls()
   { }
   .
   .
}

Now Consider This

public class someClass : System.Web.UI.Control
    { 
       // This should not compile but it does
        protected override void CreateChildControls()
        { }

       // This should compile but it does not
        protected internal override void CreateChildControls()
        { }  
    }

can any body explain this ? Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about virtual-method