Vb.net 基构造函数不返回到子构造函数

Vb.net 基构造函数不返回到子构造函数,vb.net,Vb.net,有人能解释一下为什么调用子类cstr时会转到基本构造函数清除部分吗。但当在基cstr中到达MethodA()时,它将永远不会返回到子构造函数来设置值Otherproperty。为什么会这样。例如,当我从基中删除MethodA()时,它将返回到child ans set my variable。大学教师;我不明白 基类cstr: Public Sub New(configpath As String, reportPath As String) _serializerPath =

有人能解释一下为什么调用子类cstr时会转到基本构造函数清除部分吗。但当在基cstr中到达MethodA()时,它将永远不会返回到子构造函数来设置值Otherproperty。为什么会这样。例如,当我从基中删除MethodA()时,它将返回到child ans set my variable。大学教师;我不明白

基类cstr:

 Public Sub New(configpath As String, reportPath As String)
        _serializerPath = configpath
        _reportPath = reportPath
        MethodA() 
    End Sub
子类cstr:(从基继承)


什么是MyBase?难道这不应该是MyBase吗?@Chris Dunaway抱歉只是一个输入错误MethodA做什么?另外,您是否正确设置了“Otherproperty”?正如在您发布的示例中,您可以简单地将其设置为空字符串。@AugustoQ是的,我设置了它。MethodA是一个方法,它对所有孩子都是mutinherit,因此也是由我的子类调用的,所以它调用了它的子类实现。您在哪里尝试访问“Otherproperty”?在对象生成之后还是在MethodA执行期间?另外,您确定MethodA中没有发生任何异常吗?
Public Sub New(configpath As String, reportPath As String)
        MyBase.New(configpath, reportpath)

        Otherproperty = "XXX"
End Sub