有没有办法让这样的工作?
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TMyRecord = record
class operator Explicit(const a: array of integer): TMyRecord;
end;
{ TMyRecord }
class operator TMyRecord.Explicit(const a: array of integer): TMyRecord;
begin
end;
var
a: array[0..100] of integer;
begin
TMyRecord(a); //Incompatible types: 'array of Integer' and 'array[0..100] of Integer
end.
“TMyRecord.Explicit(const a: TIntegerDynArray)”适用于 TIntegerDynArray,但我无法让静态数组工作。