Constructor Examples

Constructor Example 2

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

Namespace Constructor2
    Class Program
        Class Company
            Public code As Integer
            Public name As String

            Public Sub New(ByVal _code As Integer, ByVal _name As String)
                code = _code
                name = _name
            End Sub
        End Class

        Private Shared Sub Main(ByVal args As String())
            Dim emp As Company = New Company(101, "KKCC INFO SYSTEMS")
            Console.WriteLine("Code=" & emp.code)
            Console.WriteLine("Name=" & emp.name)
        End Sub
    End Class
End Namespace



©Copyright 2016 All Rights Reserved LearnDotNetHome.com