Reputation: 28586
I have a class MyVisible
having a property Visible
.
I have a class MySuperVisible
implementing a interface ISuperVisible
, that contains also property Visible
.
How should I implement the "Visible" property of the interface "ISuperVisible" in "MySuperVisible" class?
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
is implementing a private property the only solution to do it?
PS. MySuperVisible inherits MyVisible, so I need to implement a property that already exists in the base class.
Upvotes: 1
Views: 287
Reputation: 7592
Interesting question. I think the Shadows
keyword is probably the appropriate way to go here. That makes things a little more explicit than PrivatePropertyPlaceholder
:
Public Shadows Property Visible As Boolean Implements ISuperVisible.Visible
Get
Return MyBase.Visible
End Get
Set(value As Boolean)
MyBase.Visible = value
End Set
End Property
Upvotes: 3