What's the difference between ref attribute and var parameter?

What's the difference between ref attribute and var parameter?

function FunctionName(const [Ref] parameter1: Class1Name; [Ref] const parameter2: Class2Name);

function DoubleByRef(var X: Integer): Integer;

Is it the same thing?

Comments

  1. Leif Uneus what it might be useful? some simple example?

    ReplyDelete
  2. Jacek Laskowski It is useful if you want to make sure that a const parameter is passed by reference.
    David Heffernan pretty much covers a simple use case here: stackoverflow.com - Is the [Ref] attribute for const record parameters useful?

    ReplyDelete

Post a Comment