Changeset 246 for Include/Classes/System/Object.ab
- Timestamp:
- May 12, 2007, 6:31:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Object.ab
r237 r246 1 Class Object2 1 3 Public 2 Namespace System 4 3 5 Sub Object() 6 End Sub 7 Sub ~Object() 8 End Sub 4 Class Object 9 5 10 ' 2つのオブジェクトが等しいかどうかを判断する 11 Virtual Function Equals( object As Object ) As Boolean 12 If ObjPtr(This) = ObjPtr(object) Then 13 ' If This.GetHashCode() = object.GetHashCode() Then 14 Return True 15 Else 16 Return False 17 End If 18 End Function 19 20 Static Function Equals( objectA As Object, objectB As Object ) As Boolean 21 If ObjPtr(objectA) = NULL /*objectA = Nothing*/ Then 22 Return ObjPtr(objectB) = NULL 'objectB = Nothing 23 Else 24 Return objectA.Equals(objectB) 25 End If 26 End Function 6 Public 27 7 28 ' 参照先が等しいか判断する 29 Static Function ReferenceEquals(objectA As Object, objectB As Object) As Boolean 30 If ObjPtr( objectA ) = ObjPtr( objectB) Then 31 Return True 32 Else 33 Return False 34 End If 35 End Function 8 Sub Object() 9 End Sub 10 Sub ~Object() 11 End Sub 36 12 37 ' ハッシュコードを取得する 38 Virtual Function GetHashCode() As Long 39 Return ObjPtr( This ) As Long 40 End Function 13 ' 2つのオブジェクトが等しいかどうかを判断する 14 Virtual Function Equals( object As Object ) As Boolean 15 If ObjPtr(This) = ObjPtr(object) Then 16 ' If This.GetHashCode() = object.GetHashCode() Then 17 Return True 18 Else 19 Return False 20 End If 21 End Function 22 23 Static Function Equals( objectA As Object, objectB As Object ) As Boolean 24 If ObjPtr(objectA) = NULL /*objectA = Nothing*/ Then 25 Return ObjPtr(objectB) = NULL 'objectB = Nothing 26 Else 27 Return objectA.Equals(objectB) 28 End If 29 End Function 41 30 42 ' オブジェクトに関係する文字列を返す 43 Virtual Function ToString() As String 44 Return GetType().Name 45 End Function 31 ' 参照先が等しいか判断する 32 Static Function ReferenceEquals(objectA As Object, objectB As Object) As Boolean 33 If ObjPtr( objectA ) = ObjPtr( objectB) Then 34 Return True 35 Else 36 Return False 37 End If 38 End Function 46 39 47 /* 48 Function Operator Downcast() As VoidPtr 49 End Function 50 */ 40 ' ハッシュコードを取得する 41 Virtual Function GetHashCode() As Long 42 Return ObjPtr( This ) As Long 43 End Function 44 45 ' オブジェクトに関係する文字列を返す 46 Virtual Function ToString() As String 47 Return GetType().Name 48 End Function 49 50 /* 51 Function Operator Downcast() As VoidPtr 52 End Function 53 */ 51 54 52 55 53 '----------------------------------------------------------------54 ' 実行時型情報55 '----------------------------------------------------------------56 '---------------------------------------------------------------- 57 ' 実行時型情報 58 '---------------------------------------------------------------- 56 59 57 Private58 typeInfo As TypeInfo60 Private 61 typeInfo As TypeInfo 59 62 60 Public61 Sub _System_SetType( typeInfo As TypeInfo )62 If _System_TypeBase.IsReady() = False Then63 Return64 End If63 Public 64 Sub _System_SetType( typeInfo As TypeInfo ) 65 If _System_TypeBase.IsReady() = False Then 66 Return 67 End If 65 68 66 This.typeInfo = typeInfo67 End Sub69 This.typeInfo = typeInfo 70 End Sub 68 71 69 Virtual Function GetType() As TypeInfo70 Return typeInfo71 End Function72 Virtual Function GetType() As TypeInfo 73 Return typeInfo 74 End Function 72 75 73 End Class 74 Dim aaa As Long 76 End Class 77 78 End Namespace
Note:
See TracChangeset
for help on using the changeset viewer.