MyBase: does the control move horizontally?

  • Thread starter Thread starter sougata12
  • Start date Start date
S

sougata12

Guest
My question is as follows:

In the below code when the statement MyBase.someSub() gets executed, the compiler does not find the someSub in the base class. Now that is probably the reason why the red squiggly line is coming. My question is does MyBase move only in the vertical direction upwards towards the ultimate base class OR is there a way to make it move horizontally? For example, in this case can we direct the compiler to look into the inherited_1b class (which also inherits the base class) when it does not find someSub in base class?

Module Module1

Class base
'Nothing
End Class

Class inherited_1a : Inherits base
Public Sub anotherSub()
MyBase.someSub() 'getting error here. red squiggly line
End Sub
End Class

Class inherited_1b : Inherits base
Public Sub someSub()
Console.WriteLine("From the inherited_1b class")
End Sub
End Class

Sub main()
Dim i As New inherited_1a()
i.anotherSub()
Console.ReadLine()
End Sub

End Module

The question may sound weird but it is just of curiosity and purely academic in nature.


Sougata Ghosh

Continue reading...
 
Back
Top