Click or drag to resize

ClassTree Function

X#
Get the class hierarchy of an object.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION ClassTree(
	oObject AS Object
) AS ARRAY
Request Example View Source

Parameters

oObject
Type: Object
An object whose class hierarchy you want to get.

Return Value

Type: Array
An array of class names from which oObject has been derived.
The last element of the array contains the root class from which subsequent classes in the array inherit.
Remarks
ClassTree() shows what other classes, if any, the class of the object inherits from.
Examples
These examples illustrate ClassTree() with multiple inheritances:
X#
 1CLASS Person
 2    EXPORT name, sign
 3CONSTRUCTOR(tName, tSign)
 4    name := tName
 5    sign := tSign
 6END CLASS
 7CLASS Male INHERIT Person
 8    EXPORT prefers
 9END CLASS
10CLASS OldMale INHERIT Male
11    EXPORT age
12END CLASS
13FUNCTION InheritanceTree()
14    LOCAL y AS OBJECT
15    LOCAL a AS ARRAY
16    y := OldMale{"Charlie", "dude"}
17    a := ClassTree(y)
18    ? ArrayGet(a, 1)            // OLDMALE
19    ? ArrayGet(a, 2)            // MALE
20    ? ArrayGet(a, 3)            // PERSON
See Also