Assign constructor parameter to object variable - Delphi -
this question has answer here:
i keep getting error dialog:
access violation @ address xxxx in module 'xxxx.exe'. write of address xxxx.
what should do?
constructor tcustomclass.create(id: integer); begin self.id := id; end;
any thoughts?
the odds problem you're calling constructor incorrectly. you're doing similar following:
var linstance: tcustomclass; begin linstance.create(1); ... end;
the problem linstance
doesn't exist yet, you're calling method on it. need create instance follows: linstance := tcustomclass.create(1);
Comments
Post a Comment