From RAD Studio API Documentation
Jump to: navigation, search


class function InheritsFrom(AClass: TClass): Boolean;


__classmethod bool __fastcall InheritsFrom(TClass AClass);


Type Visibility Source Unit Parent
function public
System TObject


Determines the relationship of two object types.

Use InheritsFrom to determine whether a particular class type or object is an instance of a class or one of its descendants. InheritsFrom returns True if the object type specified in the aClass parameter is an ancestor of the object type or the type of the object itself. Otherwise, it returns False.

Note: InheritsFrom is similar to the Delphi is operator, but applies to class references.
Note: In C++ code, a nonstatic version of InheritsFrom is provided. This call is useful in determining whether a descendant class method or property can be used, given a variable of a base class. For example, use InheritsFrom to determine whether the Sender parameter in an event handler is of a particular class type or one of its descendants.

See Also