Y
yjlucky
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TMyRecord = record
index: integer;
buf: string;
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
myrecord: ^TMyRecord;
begin
new(myrecord);
myrecord.index := 888;
showMessage(IntToStr(myRecord.index));
new(myrecord);
myrecord^.index := 888;
showMessage(IntToStr(myRecord.index));
end;
end.
为什么myrecord.index 和myrecord^.index 一样,两者没有区别吗?一般程序里面该如何调用?
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TMyRecord = record
index: integer;
buf: string;
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
myrecord: ^TMyRecord;
begin
new(myrecord);
myrecord.index := 888;
showMessage(IntToStr(myRecord.index));
new(myrecord);
myrecord^.index := 888;
showMessage(IntToStr(myRecord.index));
end;
end.
为什么myrecord.index 和myrecord^.index 一样,两者没有区别吗?一般程序里面该如何调用?