J
JB
Hi All,
I've just experienced a "strange" behaviour with inheritance and the
Protected keyword.
Can someone please shed a light on this? Is this the normal behaviour?
Class Base
Protected Sub SubBase()
'Do Stuff
End Sub
End Class
Class Derived Inherits Base
Protected Sub Test()
'Call to parent Protected Sub OK
MyBase.SubBase()
'Now trying to call SubBase on a different instance of Derived
doesn't work !
Dim AnotherDerived as Derived = SomeList.GetElement()
AnotherDerived.SubBase() 'Not accessible because it's protected !
End Sub
End Class
Thanks
JB
I've just experienced a "strange" behaviour with inheritance and the
Protected keyword.
Can someone please shed a light on this? Is this the normal behaviour?
Class Base
Protected Sub SubBase()
'Do Stuff
End Sub
End Class
Class Derived Inherits Base
Protected Sub Test()
'Call to parent Protected Sub OK
MyBase.SubBase()
'Now trying to call SubBase on a different instance of Derived
doesn't work !
Dim AnotherDerived as Derived = SomeList.GetElement()
AnotherDerived.SubBase() 'Not accessible because it's protected !
End Sub
End Class
Thanks
JB