[fpc-devel] Ambiguity between function result and overloaded function

luiz americo pereira camara luizmed at oi.com.br
Mon Jan 5 21:20:52 CET 2015


I have the following methods.

I was expecting that Result := Save; would call Save method but in fact
Save refers to the function result variable.

Is it by design?

function TSqlite3JSONObjectResource.Save(IdValue: Variant): Boolean;
begin
  if not VarIsEmpty(IdValue) then
  begin
    [..]
  end
  else
  begin
    Result := Save; <- this does not call the overloaded method
    Result := Save(); <- this calls the overloaded method
  end;
end;

function TSqlite3JSONObjectResource.Save: Boolean;
begin
[..]
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150105/fae46494/attachment.html>


More information about the fpc-devel mailing list