请看代码:
1 public abstract class ViewBaseContainer : Page 2 { 3 protected abstract ControllerBaseContainer CreateConcreteContainer (Page owner); 4 } 5 public class BasePage : ViewBaseContainer 6 { 7 protected override ControllerBaseContainer CreateConcreteContainer(BasePage owner) 8 { 9 } 10 }
在BasePage中重写方法CreateConcreteContainer(),传递的参数是BasePage的对象,会导致编译失败,这里传递的参数必须为Page的对象吗?为什么?
达令说
月关宝盒