System.TObject.InheritsFrom

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

class function InheritsFrom(AClass: TClass): Boolean;

C++

__classmethod bool __fastcall InheritsFrom(TClass AClass);

Properties

Type Visibility Source Unit Parent
function public
System.pas
systobj.h
System TObject

Description

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 Object Pascal 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