Implement a program to display any message at run time using Constructor in VB.NET

Module Module1
    Class Line
        Private l As Double
        Public Sub New()
            Console.Write("Object is being created")
        End Sub
        Public Sub setlength(ByVal len As Double)
            l = len
        End Sub
        Public Function getLength() As Double
            Return l
        End Function
    End Class
    Sub Main()
        Dim L As Line = New Line()
        Console.Write("Length O f line:{0}", L.getLength())
    End Sub
End Module

Object is being created
Length O f line 6


Post a Comment

If you have any query, please let us know