unit Static;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMyClass = Class
public
class procedure SetStaticMemberValue(AString: string);
class function GetStaticMemberValue: string;
end;
var
Form1: TForm1;
implementation
var
AStaticMember: string;
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
TMyClass.SetStaticMemberValue('MyClass');
showmessage(TMyClass.GetStaticMemberValue);
end;
{ TMyClass }
class function TMyClass.GetStaticMemberValue: string;
begin
Result := AStaticMember;
end;
class procedure TMyClass.SetStaticMemberValue(AString: string);
begin
AStaticMember := AString;
end;
end.