Delphi: Infracción de acceso al final del constructor Create ()
Tengo una clase muy básica y simple como esta:
unidad de cargador;
interface
uses
Vcl.Dialogs;
type
TLoader = Class(TObject)
published
constructor Create();
end;
implementation
{ TLoader }
constructor TLoader.Create;
begin
ShowMessage('ok');
end;
end.
Y desde Form1 lo llamo así:
procedure TForm1.Button1Click(Sender: TObject);
var
the : TLoader;
begin
the := the.Create;
end;
Ahora, justo después de lathe := the.Create
parte, delphi muestra el mensaje con'ok'
y luego me da un error y diceProject Project1.exe raised exception class $C0000005 with message 'access violation at 0x0040559d: read of address 0xffffffe4'.
También muestra esta línea:
constructor TLoader.Create;
begin
ShowMessage('ok');
end; // <-------- THIS LINE IS MARKED AFTER THE ERROR.
Soy nuevo en Delphi. Estoy usando Delphi XE2 y no pude arreglar este error. ¿Alguien me muestra un camino o tiene solución para esto?