unit Unit1;
interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TEvent
=
procedure () of object;
TProc
=
procedure();
TForm1
=
class
(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private

{ Private declarations }
public

{ Public declarations }
end;
var
Form1: TForm1;
implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
showmessage(
'
方法指针的长度是:
'
+
Inttostr(SizeOf(TEvent)));
showmessage(
'
函数指针的长度是:
'
+
Inttostr(SizeOf(TProc)));
end;
//
函数指针是指向函数的32位指针,占4个字节。
//
过程的指针结构如下
//
PProc = ^TProc;
//
过程指针
//
TProc = record
//
Code: Pointer;
//
指向过程的代码
//
end;
//
方法指针是指向一个结构。方法的指针结构如下
//
PMethod = ^TMethod;
//
方法指针
//
TMethod = record
//
Code: Pointer;
//
指向方法的代码
//
Data: Pointer;
//
指向对象的数据
//
end;


end.
1318

被折叠的 条评论
为什么被折叠?



