25 Constructor and Destructor in VB.NET

Code:

Module Module1

    Public Class Test
        Public Sub New()
            Console.WriteLine(" Constructor ")
        End Sub

        Protected Overrides Sub Finalize()
            Console.WriteLine(" Destructor ")
            Console.ReadKey()
        End Sub

    End Class


    Sub Main()
        Dim a As Test
        a = New Test

    End Sub

End Module




Output:  


Previous
Next Post »