Basically, I have a nice and simple object such as
[pascal]
TObj = class
public
x,y: integer;
end;[/pascal]
And I do this to create the object:
[pascal]
var
myObj: TObj;
myObj := TObj.Create;
[/pascal]
And basically, I want to be able to call my own code as well as the inherited code when .Create is called.
I tried adding
[pascal]
procedure Create; override;
...
procedure TObj.Create;
begin
x := 0;
y := 0;
inherited;
end;
[/pascal]
But it said: villager.pas(17,21) Error: There is no method in an ancestor class to be overridden: "TVillager.Create;"
FPC 2.4.0, Lazarus .9.28.3. (Shouldn't matter, but eh).
I can work around this if it's not possible (or I don't receive a response in time), but it's going to be ugly.
Bookmarks