TObject::ClassNameIs
Determines whether an object is of a specific type.
typedef TMetaClass* TClass;
static
bool __fastcall
ClassNameIs(TClass cls, const AnsiString string);
bool __fastcall ClassNameIs(const AnsiString string){ return ClassNameIs(ClassType(), string); }
Description
Use ClassNameIs when writing conditional code based on an object’s type or to query objects across modules or DLLs.
Call the static ClassNameIs method to verify that a TClass variable represents a particular class (such as “TButton”). Call ClassNameIs with a single AnsiString parameter to determine whether a particular object instance is of the specified type.
To determine whether an object is of a specified type or one of its descendants, use the InheritsFrom method instead.
ClassNameIs returns true if the string passed in the string parameter matches the name of the class. Otherwise, it returns false
Partager