Imports System
Module Test
Sub Main()
Dim p as Point = New Point()
Console.WriteLine("(" & p.X & "," & p.Y & ")")
Try
p.X = -100
p.Y = -100
Catch e as ArgumentOutOfRangeException
Console.WriteLine(e.Message)
End Try
Console.WriteLine("(" & p.X & "," & p.Y & ")")
End Sub
End Module
Public Class Point
Private yCoord as Integer
Private xCoord as Integer
Public Property X as Integer
Get
Return(xCoord * 2)
End Get
Set(ByVal Value as Integer)
xCoord = Value
End Set
End Property
Public Property Y as Integer
Get
Return(yCoord)
End Get
Set(ByVal Value as Integer)
yCoord = Value
End Set
End Property
End Class
|