16,748
社区成员
发帖
与我相关
我的任务
分享
TFoo = class(TComponent)
...
end;
TFooA = class(TFoo)
...
end;
TFooList<T: TFoo> = class(TComponent)
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function Remove(Item: T): Integer;
...
end;
procedure TFooList<T>.Notification(AComponent: TComponent; Operation: TOperation);
begin
if Operation = opRemove then
Remove(AComponent); //这句出错,有什么办法解决?
end;
TFooList<T: Foo> = class(TComponent)
PT = ^T;
...
Remove(PT(@AComponent)^);
TBar = class(TFoo);
TBarList = class(TFooList<TBar>);
...
function TBarList.Remove(Item: TBar): Integer; //这里是TBar而不是TFoo