gpt4 book ai didi

添加后 delphi TCollection 计数不增加

转载 作者:行者123 更新时间:2023-12-02 11:15:25 26 4
gpt4 key购买 nike

我有类型

  • TNotifyReply = 类(TCollectionItem)
  • TNotifyReplylist = 类(TOwnedCollection)

NotifyReplylist := TNotifyReplylist.Create(self, TNotifyReply);

调用此函数后(任意次数),计数仍然为零

function TNotifyReplylist.addItem: TNotifyReply;
begin
Result := inherited Add as TNotifyReply;
OutputDebugString(PAnsiChar('Count > '+ inttostr(count)));
end;

知道这里发生了什么吗?

最佳答案

发现问题了,TNotifyReply.Create是

constructor TNotifyReply.Create(ACollection: TCollection);
begin
inherited Create(Collection);
....

更改为

inherited Create(ACollection);

关于添加后 delphi TCollection 计数不增加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3437567/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com