source: Include/Classes/System/Object.ab@ 207

Last change on this file since 207 was 207, checked in by dai, 17 years ago

動的型情報(Object.GetType)に対応。
戻り値やクラスメンバがオブジェクトだったとき、その初期値をNothingにした(※戻り値として関数名を使っている部分、要注意!!)。

File size: 1.2 KB
RevLine 
[51]1Class Object
[195]2
[51]3Public
4
[58]5 Sub Object()
6 End Sub
7 Sub ~Object()
8 End Sub
9
[51]10 ' 2つのオブジェクトが等しいかどうかを判断する
[195]11 Virtual Function Equals( object As Object ) As Boolean
12 If This.GetHashCode() = object.GetHashCode() Then
[51]13 Return True
14 Else
15 Return False
16 End If
17 End Function
[195]18 Static Function Equals( objectA As Object, objectB As Object ) As Boolean
19 Return objectA.Equals( objectB )
[51]20 End Function
21
22 ' ハッシュコードを取得する
23 Virtual Function GetHashCode() As Long
[70]24 Return VarPtr( This ) As Long
[51]25 End Function
26
27 ' オブジェクトに関係する文字列を返す
28 Virtual Function ToString() As String
29 Return "Object"
30 End Function
[195]31
32/*
33 Function Operator Downcast() As VoidPtr
34 End Function
35*/
[207]36
37
38 '----------------------------------------------------------------
39 ' 実行時型情報
40 '----------------------------------------------------------------
41
42Private
43 typeInfo As TypeInfo
44
45Public
46 Sub _System_SetType( typeInfo As TypeInfo )
47 If _System_TypeBase.IsReady() = False Then
48 Return
49 End If
50
51 This.typeInfo = typeInfo
52 End Sub
53
54 Function GetType() As TypeInfo
55 Return typeInfo
56 End Function
57
[51]58End Class
[207]59Dim aaa As Long
Note: See TracBrowser for help on using the repository browser.