Can not create 2 properties with same signature.

  • Thread starter Thread starter Mythran
  • Start date Start date
M

Mythran

Why can't we create 2 properties with the same signature .. one on a base
class and one on a derived class, even though both properties are shared?

Public Shared ReadOnly Property MyProperty() As Integer

Thanks,
Mythran
 
Hello Mythran,
Why can't we create 2 properties with the same signature .. one on a
base class and one on a derived class, even though both properties are
shared?

Public Shared ReadOnly Property MyProperty() As Integer

It is legal to do this. Add the Shadows keyword to the definition to explicitly
state you want this behavior.

Public Shared Shadows ReadOnly Property MyProperty() As Integer
 
Mythran said:
Why can't we create 2 properties with the same signature .. one on a base
class and one on a derived class, even though both properties are shared?

Public Shared ReadOnly Property MyProperty() As Integer


Shared members are not overridable (virtual in C{#, ++} terms), thus this is
not possible. In other words it's not possible (except by using 'Shadows',
but I think this is not a good solution) to change the behavior of a shared
member in a derived class.
 
Back
Top