Zitat von
Neutral General:
Verstanden was ich will?
Ja, verstanden, glaub ich. Hmm, also ich fürchte, dass das nicht wirklich machbar ist. Allerdings kannst du dir unter Umständen das Delphi-Konstrukt
index zu Nutze machen:
Delphi-Quellcode:
type
TBaseClass = class
private
FFields: array of integer;
protected
function GetField(Index: integer);
procedure SetField(Index: integer; Value: integer);
procedure SetFieldCount(Count: integer);
end;
TDerivedClass = class(TBaseClass)
public
property Value1: integer index 0 read GetField write SetField;
property Value2: integer index 1 read GetField write SetField;
property Value3: integer index 2 read GetField write SetField;
constructor Create;
end;
implementation
function TBaseClass.GetField(Index: integer);
begin
Result := FFields[Index];
end;
procedure TBaseClass.SetField(Index: integer; Value: integer);
begin
FFields[Index] := Value;
end;
procedure TBaseClass.SetFieldCount(Count: integer);
begin
SetLength(FFields, Count);
end;
constructor TDerivedClass.Create;
begin
SetFieldCount(3);
end;