编译本单元时:
unit Test;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
class var StartDate, EndDate: TDateTime; // Line 12
fTest: TNotifyEvent;
public
property OnTest: TNotifyEvent read fTest; // Line 15.
end;
implementation
{$R *.dfm}
end.
我收到以下编译器错误:
[DCC 错误] Test.pas(15): E2356 属性访问器必须是实例字段或方法
但是如果我注释掉第 12 行,它编译得很好。有人可以解释为什么吗?我需要将日期作为类变量来存储日期间隔。