Simple Example of MyBase vs. MyClass vs. Me vs. no qualifier.

  • Thread starter Mark Donohoe via .NET 247
  • Start date
M

Mark Donohoe via .NET 247

Here's a nice, clean example of what exactly goes on. Just look at the 'Test' method in the FooMid class.

Module Main


Public Class FooBase
Public Overridable Sub TestProc
MsgBox("FooBase TestProc")
End Sub

End Class


Public Class FooMid
Inherits FooBase

Public Overrides Sub TestProc
MsgBox("FooMid TestProc")
End Sub

Public Sub Test

MyBase.TestProc
MyClass.TestProc
Me.TestProc
TestProc

End Sub

End Class


Public Class FooTop
Inherits FooMid

Public Overrides Sub TestProc
MsgBox("FooTop TestProc")
End Sub

End Class


Public Sub Main

Dim X as new FooTop

X.Test

End Sub


End Module
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top