Constructor Examples

Constructor Example 1

        
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text

Namespace Constructor1
    Class Employee
        Public code As Integer
        Public name As String

        Public Sub New()
            code = 101
            name = "Srinivas"
        End Sub
    End Class

    Class Program
        Private Shared Sub Main(ByVal args As String())
            Dim emp As Employee = New Employee()
            Console.WriteLine("Code=" & emp.code)
            Console.WriteLine("Name=" & emp.name)
        End Sub
    End Class
End Namespace


┬ęCopyright 2016 All Rights Reserved LearnDotNetHome.com