RAD Studio Athens

E2138

Go Up to Error and Warning Messages (Delphi)

A message procedure can take only one, VAR, parameter; it's type is not checked.


program Produce;

  type
    Base = class
      procedure Msg1(xย : Integer); message 151;
      procedure Msg2(VAR x, yย : Integer); message 152;
    end;

  procedure Base.Msg1(xย : Integer);
  begin
  end;

  procedure Base.Msg2(VAR x, yย : Integer);
  begin
  end;

begin
end.

The obvious error in the first case is that the parameter is not VAR. The error in the second case is that more than one parameter is declared.


program Solve;

  type
    Base = class
      procedure Msg1(VAR xย : Integer); message 151;
      procedure Msg2(VAR yย : Integer); message 152;
    end;

  procedure Base.Msg1(VAR xย : Integer);
  begin
  end;

  procedure Base.Msg2(VAR yย : Integer);
  begin
  end;

begin
end.

The solution in both cases was to only specify one, VAR, parameter in the message method declaration.