Option Strict On
Public Class YourClass
Private yourName As String
Private yourNumber As Decimal
Public Sub New(breed As String)
yourName = breed
End Sub
Public ReadOnly Property Name() As String
Get
Return yourName
End Get
End Property
Public Property Number() As Decimal
Get
Return yourNumber
End Get
Set
yourNumber = CDec(value)
End Set
End Property
Public Sub ShowInfo()
Console.WriteLine("This " & yourName & " weighs " & yourNumber & " pounds.")
End Sub
End Class
Public Class Tester
Public Shared Sub Main()
Dim mal As New YourClass("A")
mal.Number = 130
ChangeYourClassInfo(mal)
mal.ShowInfo
CompletelyChangeYourClassInfo(mal)
mal.ShowInfo
End Sub
Public Shared Sub ChangeYourClassInfo(ByVal aYourClass As YourClass)
aYourClass.Number = 125
End Sub
Public Shared Sub CompletelyChangeYourClassInfo(ByVal aYourClass As YourClass)
Dim newf As New YourClass("Newfoundland")
aYourClass = newf
End Sub
End Class
This A weighs 125 pounds.
This A weighs 125 pounds.