展开全部
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
StdCtrls, Dialogs;
type
TRec=record
Int: Integer;
Str: string;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Rec: TRec;
public
{ Public declarations }
procedure test(const aRec: TRec);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.test(const aRec: TRec);
begin
ShowMessage(IntToStr(aRec.Int)+':'+aRec.Str);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Rec.Int:=8;
Rec.Str:='test';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
test(Rec);
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
StdCtrls, Dialogs;
type
TRec=record
Int: Integer;
Str: string;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Rec: TRec;
public
{ Public declarations }
procedure test(const aRec: TRec);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.test(const aRec: TRec);
begin
ShowMessage(IntToStr(aRec.Int)+':'+aRec.Str);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Rec.Int:=8;
Rec.Str:='test';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
test(Rec);
end;
end.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询