Inherit destructor : Destructor « Class Module « VB.Net Tutorial






Class Base
    Public Sub New()
        Console.WriteLine("The Base Class Constructor is Running")
    End Sub

    Protected Overrides Sub Finalize()
        Console.WriteLine("The Base Class Destructor is Running")
        MyBase.Finalize()
    End Sub
End Class

Class Derived
    Inherits Base
    Public Sub New()
        Console.WriteLine("The Derived Class Constructor is Running")
    End Sub

    Protected Overrides Sub Finalize()
        Console.WriteLine("The Derived Class Destructor is Running")
        MyBase.Finalize()
    End Sub
End Class


Module Module1
    Sub Main()
        Dim Sample As New Derived()

    End Sub

End Module
The Base Class Constructor is Running
The Derived Class Constructor is Running
The Derived Class Destructor is Running
The Base Class Destructor is Running








6.31.Destructor
6.31.1.Destructor in three levels
6.31.2.Inherit destructor