Canvas.Pixels[10, 20] := clRed;
Params.Values['PATH'] := 'C:\BIN';
correspond to
if Collection.GetObject(0) = nil then Exit;
Canvas.SetPixel(10, 20, clRed);
Params.SetValue('PATH', 'C:\BIN');
The definition of an array property can be followed by the default directive, in which case the array property becomes
the default property of the class. For example,
type
TStringArray = class
public
property Strings[Index: Integer]: string ...; default;
...
end;
If a class has a default property, you can access that property with the abbreviation
object[index]
, which is
equivalent to
object.property[index]
. For example, given the declaration above,
StringArray.Strings
[7]
can be abbreviated to
StringArray[7]
. A class can have only one default property. Changing or hiding the
default property in descendant classes may lead to unexpected behavior, since the compiler always binds to
properties statically.
Dostları ilə paylaş: