Template
Function
Name
__objDerivedFrom()
Category
API
Subcategory
Objects
Oneliner
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. <xSuper> 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" PROCEDURE 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 CREATE CLASS TMood METHOD New() INLINE Self ENDCLASS CREATE CLASS THappy FROM TMood METHOD Smile() INLINE QOut( "*smile*" ) ENDCLASS CREATE CLASS TShirt VAR Color VAR Size METHOD New() INLINE Self ENDCLASS
Compliance
Harbour
Files
Library is core
Seealso
__objHasData(), __objHasMethod()
Pingback: Harbour Internal Functions | Viva Clipper !
Pingback: Harbour Objects Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !