Overrides后为什么没有走子类的方法?
如下执行后,输出内容为"Parent TestFun”,为什么不是"Children TestFun"呢?
-------------------MoudleTest.vb---------------------
Module MoudleTest
Sub Main()
Dim test As New Children
test.ParentFun()
Console.Read()
End Sub
End Module
-----------------------------------------------------
-------------------Parent.vb-------------------------
Public Class Parent
Public Sub ParentFun()
TestFun()
End Sub
Protected Overridable Sub TestFun()
Debug.Print("Parent TestFun")
End Sub
End Class
-----------------------------------------------------
-------------------Children.vb-------------------------
Public Class Children
Inherits Parent
Protected Overloads Sub TestFun()
Debug.Print("Children TestFun")
End Sub
End Class
-----------------------------------------------------
[解决办法]
Overrides