Dann wird das aber etwas komplizierter:
Delphi-Quellcode:
interface
type
THeapArray = array [0..3,0..65535] of Single;
PHeapArray = ^THeapArray;
IHeapArray = interface(IInterface)
function GetHeapArray: PHeapArray;
property HeapArray: PHeapArray read GetHeapArray;
end;
THeapRecord = record
private
FHeapArray: IHeapArray;
function GetItems: PHeapArray;
public
property Items: PHeapArray read GetItems;
end;
implementation
type
THeapObject = class(TInterfacedObject, IHeapArray)
private
FItems: THeapArray;
protected
function GetHeapArray: PHeapArray;
end;
{ THeapObject }
function THeapObject.GetHeapArray: PHeapArray;
begin
Result := @FItems;
end;
{ THeapRecord }
function THeapRecord.GetItems: PHeapArray;
begin
if not Assigned(FHeapArray) then
FHeapArray := THeapObject.Create;
Result := FHeapArray.HeapArray;
end;
Delphi-Quellcode:
procedure TForm1.ButtonTestClick(Sender: TObject);
var
MyRecord: THeapRecord;
begin
MyRecord.Items[2, 65000] := 1.456;
ShowMessage(Format('Wert: %f', [MyRecord.Items[2, 65000]]));
end;