Public Member Variable : Public « 2D « VB.Net






Public Member Variable

Public Member Variable
Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())
      Dim d1 As New Dog( )
      d1.weight = 5

      Dim d2 As Dog = d1
 
      Console.WriteLine("Milo: {0}, d2: {1}", d1.weight, d2.weight)
      d2.weight = 7

      Console.WriteLine("Milo: {0}, d2: {1}", d1.weight, d2.weight)
    End Sub
End Class

Public Class Dog
    Public weight As Integer
End Class

           
       








Related examples in the same category

1.Use Public Member variablesUse Public Member variables