JavaScript Editor js editor     Web development 



Main Page

Places an object's class name and its ancestor class names into a variable array.

ACLASS(ArrayName, oExpression)

Parameters

ArrayName


Specifies the name of the array into which the class names are placed. If you specify the name of an array that doesn't exist, Microsoft Visual FoxPro automatically creates the array. If you specify the name of an existing array that isn't large enough to hold all the parent names, Visual FoxPro automatically increases the size of the array. If the array is larger than necessary, the array size is truncated. If you specify the name of an existing two-dimensional array, the array is redimensioned to a one-dimensional array.
oExpression


Specifies an object whose class name and ancestor class names are placed into the array. oExpression can be any object expression, such as an object reference, an object variable, or an object array element.

Return Value

Numeric

Remarks

ACLASS(В ) creates a one-dimensional array containing the class name of the specified object and its ancestor class names. The first array element contains the class name of the object, the second element contains the name of the object's parent class, the third element contains the name of the object's grandparent class, and so on.

ACLASS(В ) returns the number of class names in the array. ACLASS(В ) returns 0 if the array cannot be created.

Example

The following example creates two custom classes named FormChild and FormGrandChild from the Visual FoxPro Form base class. ACLASS(В ) is used to create an array named gaNewarray containing the class names, which are then displayed.

В Copy Code
CLEAR
frmMyForm = CREATEOBJECT("FormGrandChild")
FOR nCount = 1 TO ACLASS(gaNewarray, frmMyForm)    && Creates an array
   ? gaNewarray(nCount)  && Displays the names of the classes
ENDFOR
RELEASE frmMyForm

DEFINE CLASS FormChild AS FORM
ENDDEFINE

DEFINE CLASS FormGrandChild AS FormChild
ENDDEFINE

See Also



JavaScript Editor js editor     Web development