Name
Type Keyword
Syntax
typeName=Type declaration; ... typeName= typeType declaration; typeName1=Name2; typeName= (Identifier, ...); typeName=Expr1..Expr2; typeName= ^Type; typeName= array[...] ofName; typeName= class ... end; typeName= class of ...; typeName= dispinterface ... end; typeName= file ofType; typeName= function ...; typeName= interface ... end; typeName= object ... end; typeName= procedure ...; typeName= record ... end; typeName= set ofOrdinal type;
Description
The type keyword begins a type declaration, as it
does in standard Pascal.
If the type declaration begins with another occurrence of the
type keyword, Delphi generates unique RTTI for the
type, even if the type is just a synonym for an existing type. It
also makes the type a distinct type with regard to
var parameters.
Tips and Tricks
A common convention in Delphi programs is to begin type names with the letter T, except for exception classes (which begin with E), interfaces (which begin with I), and pointer types (which begin with P).
A forward class declaration must be resolved in the same type block where it is declared. For example:
type
TExample = class; // forward declaration
TOther = class
procedure Example(E: TExample);
end;
// Full class declaration without using another "type" keyword,
// which starts a new type block.
TExample = class
procedure Example(Other: TOther);
end;A class declaration in the interface section of a unit must have definitions for all of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access