相关疑难解决方法(0)

覆盖受保护的内部受保护!

这是一小时前提出的extension这个问题.

我们不能修改access modifiers重写一个时,virtual methodderived类.考虑命名空间中的ControlSystem.Web.UI

public class Control : IComponent, IDisposable,...
{ 
   protected internal virtual void CreateChildControls()
   { }
   .
   .
}
Run Code Online (Sandbox Code Playgroud)

现在考虑一下

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()
        { }  
    }
Run Code Online (Sandbox Code Playgroud)

任何机构可以解释一下吗?谢谢

c# virtual-functions

27
推荐指数
2
解决办法
9486
查看次数

标签 统计

c# ×1

virtual-functions ×1