Ah, du hast die Antwort schon selber gefunden.
Aber falls der Nächste in achtdreiviertel Jahren beim Googlen hier lang kommt:
Obigen Code aus meiner Antwort ergänzen mit:
Delphi-Quellcode:
type
TTest = class
private
aStr: TAStr;
aInt: TAInt;
public
constructor Create;
destructor Destroy; override;
function GetInteger(const Index: Integer): Integer;
function GetString(const Index: Integer): String;
procedure SetInteger(const Index, Value: Integer);
procedure SetString(const Index: Integer; const Value: String);
published
property s0: String index 0 read GetString write SetString;
property i0: Integer index 0 read GetInteger write SetInteger ;
end;
...
constructor TTest.Create;
begin
inherited;
aStr := TAStr.Create;
aInt := TAInt.Create;
end;
destructor TTest.Destroy;
begin
aStr.Free;
aInt.Free;
inherited;
end;
function TTest.GetInteger(const Index: Integer): Integer;
begin
Result := Self.aInt.i0;
end;
function TTest.GetString(const Index: Integer): String;
begin
Result := Self.aStr.s0;
end;
procedure TTest.SetInteger(const Index, Value: Integer);
begin
Self.aInt.i0 := Value;
end;
procedure TTest.SetString(const Index: Integer; const Value: String);
begin
Self.aStr.s0 := Value;
end;
Delphi-Quellcode:
procedure TestTest;
var
MyTest: TTest;
begin
MyTest := TTest.Create;
MyTest.s0 := 'Huhu';
MyTest.i0 := 123;
Writeln(MyTest.s0);
Writeln(MyTest.i0);
MyTest.Free;
end;