【发布时间】:2012-08-17 13:03:35
【问题描述】:
我有一个类MyVisible 有一个属性Visible。
我有一个类MySuperVisible 实现了一个接口ISuperVisible,它还包含属性Visible。
我应该如何在“MySuperVisible”类中实现接口“ISuperVisible”的“Visible”属性?
Class MySuperVisible
Inherits MyVisible
Implements ISuperVisible
...
Private Property PrivatePropertyPlaceholder Implements ISuperVisible.Visible
Get
Return MyBase.Visible
End Get
Set
MyBase.Visible = value
End Set
End Property
实现私有属性是唯一的解决方案吗?
附言。 MySuperVisible 继承了 MyVisible,所以我需要实现一个已经存在于基类中的属性。
【问题讨论】:
-
为什么要实现私有属性?
MyBase.Visible是什么?我想你还没有给我们所有的信息。难道MySuperVisible继承自MyVisible并实现ISuperVisible? -
如果我理解正确,
MyVisible中的Visible属性与实现ISuperVisible中的Visible的需要相冲突。是对的吗?如果是这样,我相信 Mike C 是对的:如果我没记错的话,Shadows应该强制MySuperVisible中的实现覆盖MyVisible中的实现。 -
是的,感谢 Mike C 完成了这个问题。 MySuperVisible继承了MyVisible,所以我需要实现一个已经存在于基类中的属性...