__objDerivedFrom()
Determine whether a class is derived from another class
- Syntax
-
- __objDerivedFrom( <oObject>, <xSuper> ) --> lIsParent
- Arguments
-
- <oObject> is the object to check.
- <xSuper> is the object that may be a parent. can be either an Object or a Character string with the class name.
- Returns
-
- __objDerivedFrom() return a logical TRUE (.T.) if <oObject> is derived from <xSuper>.
- Description
-
- __objDerivedFrom() is a low level class support function that check is one class is a super class of the other, or in other words, does class <oObject> a child or descendant of <xSuper>.
Examples
// Create three classes and check their relations
#include "hbclass.ch"
FUNCTION main()
local oSuper, oObject, oDress
oSuper := TMood():New()
oObject := THappy():New()
oDress := TShirt():New()
? __objDerivedFrom( oObject, oSuper ) // .T.
? __objDerivedFrom( oSuper, oObject ) // .F.
? __objDerivedFrom( oObject, oDress ) // .F.
RETURN NIL
CLASS TMood
METHOD New() INLINE Self
ENDCLASS
CLASS THappy FROM TMood
METHOD Smile() INLINE qout( "*smile*" )
ENDCLASS
CLASS TShirt
DATA Color
DATA Size
METHOD New() INLINE Self
ENDCLASS
- Status
- Ready
- Compliance
-
- __objDerivedFrom() is a Harbour extension.
- Files
-
- Library is rtl
- See Also