[fpc-pascal] readonly variables

Anthony Walter sysrpl at gmail.com
Sat Nov 28 18:10:48 CET 2009


procedure InitMyVariable(Value: T);
function MyVariable: T;

implementation

var
  PrivateMyVariable: T;
  PrivateMyVariableSet: Boolean;

procedure InitMyVariable(Value: T);
begin
  if not PrivateMyVariableSet then
    PrivateMyVariable := Value;
  PrivateMyVariableSet := True;
end;

function MyVariable: T;
begin
  Result := PrivateMyVariable;
end;



More information about the fpc-pascal mailing list