这是一小时前提出的extension这个问题.
我们不能修改access modifiers重写一个时,virtual method在derived类.考虑命名空间中的Control类System.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)
任何机构可以解释一下吗?谢谢