VB.Net program to return an object of the class from the user-defined function
'VB.Net program to return an object of the class
'from a user defined function.
Module Module1
Class Cls
Public num1 As Integer
Public num2 As Integer
End Class
Function GetObject() As Cls
Dim M As New Cls
M.num1 = 10
M.num2 = 20
Return M
End Function
Sub Main()
Dim str As New Cls
str = GetObject()
Console.WriteLine("Member of class are:")
Console.WriteLine("Num1: {0}", str.num1)
Console.WriteLine("Num2: {0}", str.num2)
End Sub
End Module
Member of class are:
Num1: 10
Num2: 20
Press any key to continue . . .
Table of Contents