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()
        L.setlength(6.0)
        Console.Write("Length O f line:{0}", L.getLength())
        Console.ReadKey()
    End Sub
End Module

O/P:
Object is being created
Length O f line 6

Comments

Post a Comment

If you have any query, please let us know