delphi TCollection count not increasing after Add
-
26-09-2019 - |
Question
i have the types
- TNotifyReply = class(TCollectionItem)
- TNotifyReplylist = class(TOwnedCollection)
NotifyReplylist := TNotifyReplylist.Create(self, TNotifyReply);
After calling this function (Any number of times), Count it still zero
function TNotifyReplylist.addItem: TNotifyReply;
begin
Result := inherited Add as TNotifyReply;
OutputDebugString(PAnsiChar('Count > '+ inttostr(count)));
end;
Any idea whats going on here?
Solution
Found the problem, TNotifyReply.Create was
constructor TNotifyReply.Create(ACollection: TCollection);
begin
inherited Create(Collection);
....
changed to
inherited Create(ACollection);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow