如果这个标题让人困惑,我很抱歉。这个问题可能是由于缺乏咖啡和/或睡眠,但我的大脑现在工作不正常。
不管怎样,我有一个这样的继承树(我知道架构并不理想):
BaseClass GeneralForm : Inherits BaseClass SpecificForm : Inherits GeneralForm
MyItem MySpecificItem : Inherits MyItem
我有 Items As List (Of MyItem) BaseClass . 我想要一个 SpecificForm 以某种方式覆盖 Items 返回类型 List (Of MySpecificItem)
Items As List (Of MyItem)
BaseClass
SpecificForm
Items
List (Of MySpecificItem)
非常感谢。
如果上述不可能,是否可以采取 List (Of MyItem) (我的指定项的)列表 ? MySpecificItem 只有一个特定于 特殊形式 ,但我需要它。
List (Of MyItem)
(我的指定项的)列表
MySpecificItem
特殊形式
有人吗?:\
你应该能进去 SpecificForm
Private pMySpecificItems As List(Of MySpecificItem) Public Shadows ReadOnly Property Items() As List(Of MySpecificItem) Get Return pMySpecificItems End Get End Property
“Shadows”关键字将告诉编译器SpecificForm中的这个属性对基类窗体隐藏Items属性。
List(Of MySpecificItem)