复制
这是我的代码:
public class Base
{
protected BindingList<SampleBase> m_samples;
public Base() { }
}
public class Derived : Base
{
public Derived()
{
m_samples = new BindingList<SampleDerived>();
}
}
SampleDerived 派生自 SampleBase
根据继承逻辑,我应该可以做到这一点。但是,它不能编译 - 错误表明 SampleBase 不能被隐式转换为 SampleDerived 类型。是什么赋予了?
我正在使用 c# 2.0