我有一个非常基本和简单的类,如下所示:
单元装载机;
interface
uses
Vcl.Dialogs;
type
TLoader = Class(TObject)
published
constructor Create();
end;
implementation
{ TLoader }
constructor TLoader.Create;
begin
ShowMessage('ok');
end;
end.
从 Form1 我这样称呼它:
procedure TForm1.Button1Click(Sender: TObject);
var
the : TLoader;
begin
the := the.Create;
end;
现在,就在这the := the.Create
部分之后,delphi 显示消息,'ok'
然后给我一个错误并说Project Project1.exe raised exception class $C0000005 with message 'access violation at 0x0040559d: read of address 0xffffffe4'.
它还显示了这一行:
constructor TLoader.Create;
begin
ShowMessage('ok');
end; // <-------- THIS LINE IS MARKED AFTER THE ERROR.
我是德尔福的新手。我正在使用 Delphi XE2,但我无法修复此错误。有没有人给我指路或有解决方案?