J
Joe Duchtel
Hello -
I have a base class that has some member variables I do not want to be
inherited or visible by any instance of that derived class.
Class cBase
Public mVariable As String
...
Class cDerived
Inherits cBase
Hide mVariable ' <<< Private Shadows mVariable As ... is not
working
The problem if I use Private Shadows in the derived class is that an
instance will still show the variable in the base class:
Dim lDummy As New cDerived
lDummy.mVariable will be mVariable of cBase.
I tried Protected in cBase but then I cannot see mVariable in other
derived classes anymore.
I realize that there is no data encapsulation in my example but there
is a (legacy) reason for that. I would have the same problem if I
were to use an accessor or Property.
Is there any mechanism in VB.NET that will allow me to completely hide
a member variable of the base class in a particular derived class?
Thanks,
Joe
I have a base class that has some member variables I do not want to be
inherited or visible by any instance of that derived class.
Class cBase
Public mVariable As String
...
Class cDerived
Inherits cBase
Hide mVariable ' <<< Private Shadows mVariable As ... is not
working
The problem if I use Private Shadows in the derived class is that an
instance will still show the variable in the base class:
Dim lDummy As New cDerived
lDummy.mVariable will be mVariable of cBase.
I tried Protected in cBase but then I cannot see mVariable in other
derived classes anymore.
I realize that there is no data encapsulation in my example but there
is a (legacy) reason for that. I would have the same problem if I
were to use an accessor or Property.
Is there any mechanism in VB.NET that will allow me to completely hide
a member variable of the base class in a particular derived class?
Thanks,
Joe