difference between ME and MYCLASS

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.


.



Relevant Pages

  • Re: How to correctly by pass "protected"
    ... public class Parent ... public class Child ... I can change the Child class package ...
    (comp.lang.java.programmer)
  • Re: difference between ME and MYCLASS
    ... the following code produces "Child other ... Public Class Parent ... Public Overridable Sub OtherStuff() ...
    (microsoft.public.dotnet.languages.vb)
  • Re: inheritance of static attribute?
    ... > I have the parent class Parent in which I declare a static attribute ... and a child class which also declares the static attibute ... > public class child extends parent { ...
    (comp.lang.java.programmer)
  • Question on inheritance
    ... public class Child: Parent ... public new void Meth() ... though variable cc was assigned Child object. ...
    (microsoft.public.dotnet.languages.csharp)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)