N
Nick Dreyer
I was quite surprised to notice that Sub New() gets called twice,
once at declaration time and once at creation time. I can't figure out
why it would be called at declaration if there is no class instance
to work with. What is going on here:
Sub Main
Dim NewObject as MyClass
MsgBox("Before Creation")
NewObject= New MyClass
MsgBox("After Creation")
End Sub
Class MyClass
Sub New()
MsgBox("Running Sub New()"
End Sub
End Class
This puts out a MsgBox 4 times:
1) Running Sub New()
2) Before Creation
3) Running Sub New()
4) After Creation
|\|.
once at declaration time and once at creation time. I can't figure out
why it would be called at declaration if there is no class instance
to work with. What is going on here:
Sub Main
Dim NewObject as MyClass
MsgBox("Before Creation")
NewObject= New MyClass
MsgBox("After Creation")
End Sub
Class MyClass
Sub New()
MsgBox("Running Sub New()"
End Sub
End Class
This puts out a MsgBox 4 times:
1) Running Sub New()
2) Before Creation
3) Running Sub New()
4) After Creation
|\|.