Call to AddObject give stack overflow
Hello,
I have a small demo object
TSum = class(TObject)
public
constructor Create;
published
function Add(a, b: Integer): Integer;
end;
which is added with AddObject
I run this script
var
Sum: TSum;
begin
Sum := TSum.Create;
ShowMessage(IntToStr(Sum.Add(5, 6)));
Sum.Free;
end.
It gives stack overflow in search for properties and methods. What is wrong?
Chris
I have a small demo object
TSum = class(TObject)
public
constructor Create;
published
function Add(a, b: Integer): Integer;
end;
which is added with AddObject
I run this script
var
Sum: TSum;
begin
Sum := TSum.Create;
ShowMessage(IntToStr(Sum.Add(5, 6)));
Sum.Free;
end.
It gives stack overflow in search for properties and methods. What is wrong?
Chris
Comments
2) you can't use published method - you should define it by AddMethod (see the documentation how to do this).