這是一個壞主意嗎?在公共構造函數中調用通用的私有構造函數是否會創建多個實例,或者這是初始化類變量的有效方法?構造函數內的構造函數
Private Class MyClass
Dim _msg As String
Sub New(ByVal name As String)
Me.New()
'Do stuff
End Sub
Sub New(ByVal name As String, ByVal age As Integer)
Me.New()
'Do stuff
End Sub
Private Sub New() 'Initializer constructor
Me._msg = "Hello StackOverflow"
'Initialize other variables
End Sub
End Class
http://www.quickmeme.com/meme/3pwiuu/ – templatetypedef