变量分类:全局变量,局部变量,私有变量,公共变量,类变量
在interface出声明
TForm1=Class(TForm)
Edit1 : TEdit;
Label1 : TLabel;
Button1 : TButton;
Button2 : TButton;
Button3 : Tbutton;
procedure Button1Click(Sender : TObject);
procedure Button2Click(Sender : TObject);
procedure Button3Click(Sender : TObject);
private
{Private declarations}
Name : String; //类变量;
public
{Public declarations}
end;
Var
Form1 : TForm;
Name : String;//全局变量。
//在implementation之上定义为全局都可以看见
implementation
//在implementation之下定义为本单元看见
{$R *.dfm}
procedure TForm1.Button1Click(Sender : TObject);
var
Name : String; //局部变量;
begin
Name := '局部变量';
Edit1.Text := Name;
end;
end.
本文章摘录地址:https://www.cnblogs.com/textword/p/3972404.html
如有侵权,敬请告知,立即删除。