一、数组属性
type
TStrings = class(TPersistent)
private
function GetName(Index: Integer): string;
function GetValue(const Name: string): string;
procedure SetValue(const Name, Value: string);
public
property Values[const Name: string]: string read GetValue write SetValue;
property Names[Index: Integer]: string read GetName;
end;
二、索引属性
type
TRectangle = class
private
FCoordinates: array[0..3] of Longint;
function GetCoordinate(Index: Integer): Longint;
procedure SetCoordinate(Index: Integer; Value: Longint);
public
property Left: Longint index 0 read GetCoordinate write SetCoordinate;
property Top: Longint index 1 read GetCoordinate write SetCoordinate;
property Right: Longint index 2 read GetCoordinate write SetCoordinate;
property Bottom: Longint index 3 read GetCoordinate write SetCoordinate;
property Coordinates[Index: Integer]: Longint read GetCoordinate write SetCoordinate;
...
end;