Hi. I have the following question:
Since the methods are virtual, the following code produces "Child other
stuff" - the call runs as if pasted in Child... it runs in Parent but in the
context of Child.
-------------------------------
Module Module1
Sub Main()
Dim obj As New Child()
obj.DoSomething()
End Sub
End Module
-------------------------------
Public Class Parent
Public Sub DoSomething()
OtherStuff()
End Sub
Public Overridable Sub OtherStuff()
MsgBox("Parent other stuff")
End Sub
End Class
-------------------------------
Public Class Child
Inherits Parent
Public Overrides Sub OtherStuff()
MsgBox("Child other stuff")
End Sub
End Class
----------------------------------
Therefore, to avoid this, we have to change parent using MYCLASS....
-------------------------------
Public Class Parent
Public Sub DoSomething()
MyClass.OtherStuff()
End Sub
Public Overridable Sub OtherStuff()
MsgBox("Parent other stuff")
End Sub
End Class
-------------------------------
I'm confused as to what exactly is the difference between ME and MYCLASS -
why doesn't ME work in this case ? ME should refer to the current object,
(Parent, in this case), correct ?
Thank you.
Alex.