Const
R: TRect=(Left: 0; Top: 0; Right: 60; Bottom: 60);
You can define a rectangular;
But how do I custom types set to constant
Type
TCalPoint=class
Public
X: Integer;
Y: Integer;
Value: Single;
Public
Procedure Cal.
end;
CodePudding user response:
Trect structure, can't do that class should be a constCodePudding user response:
Because of Delphi object is a reference type, not a value type, so you can only:Const
{$J +}
C: TCalPoint=nil;
{$J -}
CodePudding user response:
Can be used to record or object type to replaceCodePudding user response:
Later versions of Delphi7, I in Delphi XE5 definition:
Type
TMyClass=class
Public
Const R: TRect=(Left: 0; Top: 0; Right: 60; Bottom: 60);
end;
CodePudding user response:
TRect is structure its memory is on the stack, the class is a class that the object is the memory on the heap (programmer yourself managing memory)