System.TObject.InheritsFrom

From RAD Studio VCL Reference
Jump to: navigation, search

Contents

Delphi Information

From System.pas

	class function InheritsFrom(AClass: TClass): Boolean;


Unit: System

Type: method

Visibility: public

Member Of: TObject

C++ Information

From System.hpp

	__classmethod bool __fastcall InheritsFrom(System::TMetaClass * aClass);


Unit: System

Type: method

Visibility: public

Member Of: 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 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

Personal tools
Translations
Newest Version