Use Public Member variables : Public « 2D « VB.Net






Use Public Member variables

Use Public Member variables
Imports System.IO

Module Module1


    Sub Main()
        Dim Drama As New Movie("Name 1", "Wednesday", "8:00PM")
        Dim Medical As New Movie("Name 2", "Thursday", "9:00PM")
        Dim Comedy As New Movie("Name 3", "Thursday", "7:00PM")

        Console.WriteLine("Show: " & Drama.Name)
        Console.WriteLine("Day: " & Drama.Day)
        Console.WriteLine("Time: " & Drama.Time)
    End Sub

End Module

    Class Movie
        Public Name As String
        Public Day As String
        Public Time As String

        Sub New(ByVal ShowName As String, ByVal DayOfWeek As String, ByVal ShowTime As String)
            Console.WriteLine("Name: " & ShowName & " Day " & DayOfWeek & " Time " & ShowTime)
            Name = ShowName
            Day = DayOfWeek
            Time = ShowTime
        End Sub
    End Class

           
       








Related examples in the same category

1.Public Member VariablePublic Member Variable