Previous Next Table of Contents

5. :isKindOf()

With Class(y), the :isKindOf() method is defined for all classes you create and allows you to test if a given object is instantiated from a class that is the same as or derived from another class. For example:

If oFido:isKindOf( Mammal() )
   ? "Fido is a mammal"
Else
   ? "You called a " + oFido:className() + " Fido!?!"
EndIf

Xbase++ doesn't support the :isKindOf() method. However, it does have the :isDerivedFrom() method which has the same functionality. One method of getting your code to work in both environments would be to use:

#xtranslate :isKindOf( <x> ) => :isDerivedFrom( <x> )

when compiling with Xbase++.


Previous Next Table of Contents