Harbour Reference Guide

 

__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

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/06/26