Object Class Supports all classes in the .NET Framework class hierarchy
Class Point Public x, y As Integer Public Sub New(ByVal x As Integer, ByVal y As Integer) Me.x = x Me.y = y End Sub Public Overrides Function Equals(ByVal obj As Object) As Boolean Dim objType As Type = obj.GetType() Dim meType As Type = Me.GetType() If Not objType.Equals(meType) Then Return False End If Dim other As Point = CType(obj, Point) Return Me.x = other.x AndAlso Me.y = other.y End Function Public Overrides Function GetHashCode() As Integer Return x XOr y End Function Public Overrides Function ToString() As String Return String.Format("({0}, {1})", x, y) End Function Public Function Copy() As Point Return CType(Me.MemberwiseClone(), Point) End Function End Class Public Class App Shared Sub Main() Dim p1 As New Point(1, 2) Dim p2 As Point = p1.Copy() Dim p3 As Point = p1 Console.WriteLine([Object].ReferenceEquals(p1, p2)) Console.WriteLine([Object].Equals(p1, p2)) Console.WriteLine([Object].ReferenceEquals(p1, p3)) Console.WriteLine("p1's value is: {0}", p1.ToString()) End Sub End Class