OOP Class 1 Example

OOP Class 1 Example

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

Namespace Program9
    Class Employee
        Private code As Integer
        Private name As String
        Private designation As String

        Public Sub storedata(ByVal _code As Integer, ByVal _name As String, ByVal _designation As String)
            code = _code
            name = _name
            designation = _designation
        End Sub

        Public Sub showdata()
            Console.WriteLine("Code= " & code)
            Console.WriteLine("Name= " & name)
            Console.WriteLine("Designation= " & designation)
        End Sub
    End Class

    Class Program
        Private Shared Sub Main(ByVal args As String())
            Dim code As Integer
            Dim name, designation As String
            Console.WriteLine("Enter Code,Name,Designaiton")
            code = Integer.Parse(Console.ReadLine())
            name = Console.ReadLine()
            designation = Console.ReadLine()
            Dim emp As Employee = New Employee()
            emp.storedata(code, name, designation)
            emp.showdata()
        End Sub
    End Class
End Namespace





┬ęCopyright 2016 All Rights Reserved LearnDotNetHome.com