Class CConstructorTest 'The New() function is called when we declare the variable, eg: 'Dim SomeVariable As New CConstructorTest("This Constructor stuff is great!") 'if we want to provide a method that doesn't require the passing of a string we 'must use overloads, which are in another code example :) Public Sub New(ByVal szDisplayThisString As String) MsgBox("Constructor Called: " & szDisplayThisString, MsgBoxStyle.Exclamation, "Constructor Test") End Sub
'this function is called when the variable is destroyed, or goes out-of-scope...
Overloads Sub Finalize(ByVal bSaveData As Boolean)
If bSaveData Then
MsgBox("Someone wanted us to save the data before terminating...")
End If
End Sub
End Class
|