May 2004
Intermediate to advanced
888 pages
22h 31m
English
Constants in Delphi are defined in a const clause, which behaves similarly to the C#’s const keyword. Here’s an example of three constant declarations in C#:
public const float ADecimalNumber = 3.14; public const int i = 10; public const String ErrorString = "Danger, Danger, Danger!";
The major difference between C# constants and Delphi language constants is that Delphi, like Visual Basic .NET, doesn’t require you to declare the constant’s type along with the value in the declaration. The Delphi compiler automatically allocates the appropriate type for the constant based on its value, or, in the case of scalar constants such as Integer, the compiler keeps track of the values as it works, and space never is allocated. Here’s an example: ...
Read now
Unlock full access