
Namespace System

	Class Object

	Public

		Sub Object()
		End Sub
		Sub ~Object()
		End Sub

		' 2つのオブジェクトが等しいかどうかを判断する
		Virtual Function Equals( object As Object ) As Boolean
			If ObjPtr(This) = ObjPtr(object) Then
	'		If This.GetHashCode() = object.GetHashCode() Then
				Return True
			Else
				Return False
			End If
		End Function
		
		Static Function Equals( objectA As Object, objectB As Object ) As Boolean
			If ObjPtr(objectA) = NULL /*objectA = Nothing*/ Then
				Return ObjPtr(objectB) = NULL 'objectB = Nothing
			Else
				Return objectA.Equals(objectB)
			End If
		End Function

		' 参照先が等しいか判断する
		Static Function ReferenceEquals(objectA As Object, objectB As Object) As Boolean
			If ObjPtr( objectA ) = ObjPtr( objectB) Then
				Return True
			Else
				Return False
			End If
		End Function

		' ハッシュコードを取得する
		Virtual Function GetHashCode() As Long
			Return ObjPtr( This ) As Long
		End Function

		' オブジェクトに関係する文字列を返す
		Virtual Function ToString() As String
			Return GetType().Name
		End Function

	/*
		Function Operator Downcast() As VoidPtr
		End Function
	*/


		'----------------------------------------------------------------
		' 実行時型情報
		'----------------------------------------------------------------

	Private
		_system_object_member_typeInfo As TypeInfo

	Public
		Sub _System_SetType( typeInfo As TypeInfo )
			If ActiveBasic.Core._System_TypeBase.IsReady() = False Then
				Return
			End If

			This._system_object_member_typeInfo = typeInfo
		End Sub

		Virtual Function GetType() As TypeInfo
			Return _system_object_member_typeInfo
		End Function

	End Class

End Namespace
