unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} type TRec = record {定义结构 TRec} name: ShortString; age: Word; constructor Create(str: ShortString; w: Word); {构造函数} end; { TRec 构造函数实现} constructor TRec.Create(str: ShortString; w: Word); begin name := str; age := w; end; //使用结构 procedure TForm1.Button1Click(Sender: TObject); var rec: TRec; begin rec.Create('李四', 81); ShowMessage(rec.name); {李四} end; end.结构的方法、属性都是在 Delphi 7 以后的版本中加入的, 非常类似与"类", 但又不如在"类"里完善;
它的其他一些新特性也好像是从"类"里搬过来的, 等在"类"里面研究吧.