E2518 演算子 '%s' はパラメータに少なくとも 1 つの '%s' 型が必要です(Delphi)

提供: RAD Studio
移動先: 案内検索

エラーと警告のメッセージ(Delphi):インデックス への移動


加算演算子のオーバーロード時には、パラメータの 1 つが戻り値と同じ型でなければなりません。



program E2518;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TFirstRec = record
  end;
  TSecondRec = record
  end;
  TThirdRec = record
    class operator Add(_a: TFirstRec; _b: TSecondRec): TThirdRec;
end;

class operator TThirdRec.Add(_a: TFirstRec; _b: TSecondRec): TThirdRec;
begin
   // code to initialize Result from the values of _a and _b
end;

begin
  Writeln('	E2518 Operator %s must take least one %s type in parameters');
end.


関連項目