1

我有类型

  • 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;

知道这里发生了什么吗?

4

1 回答 1

4

发现问题,TNotifyReply.Create 是

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

变成

inherited Create(ACollection);
于 2010-08-09T06:18:13.213 回答