In Delphi, I want to be able to create an private object that\'s associated with a class, and access it from all instances of that class. In Java, I\'d use:
pub
In Delphi static variables are implemented as variable types constants :)
This could be somewhat misleading.
procedure TForm1.Button1Click(Sender: TObject) ;
const
clicks : Integer = 1; //not a true constant
begin
Form1.Caption := IntToStr(clicks) ;
clicks := clicks + 1;
end;
And yes, another possibility is using global variable in implementation
part of your module.
This only works if the compiler switch "Assignable Consts" is turned on, globally or with {$J+}
syntax (tnx Lars).