Name
$TypeInfo Compiler Directive
Syntax
{$M-} // default {$TypeInfo Off} // default {$M+} {$TypeInfo On}
Scope
Local
Description
When the
$TypeInfo
directive is enabled, classes are
compiled with runtime type information. This means the class can have
a published
section, and the compiler stores
additional information about the class in the class’s virtual
method table.
Any class that inherits from a class with RTTI also has RTTI, so you
need the $TypeInfo
directive only for the base
class. Delphi compiles the TPersistent
class with
$TypeInfo
, so all derived classes (including
TComponent
, TForm
, and all the
VCL controls and related classes) have RTTI.
See Also
Class Keyword |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.