我有这个单位:
unit Main.TIns;
interface
type
TIns = record
private type
TInsArray = array [0..90] of Integer;
var
FInsArray: TInsArray;
public
class operator Implicit(const Value: Integer): TIns;
class operator Add(const Elem1: TIns; const Elem2: Integer): TIns;
end;
implementation
class operator TIns.Implicit(const Value: Integer): TIns;
var
iIndex: Integer;
begin
if Value = 0 then
for iIndex := 0 to 90 do Result.FInsArray[iIndex] := 0;
end;
class operator TIns.Add(const Elem1: TIns; const Elem2: Integer): TIns;
begin
Inc(Result.FInsArray[0]);
Result.FInsArray[Result.FInsArray[0]] := Elem2;
end;
end.
Run Code Online (Sandbox Code Playgroud)
主要程序是: …