我有一个类似这样的通用集合:
TFoo = class;
TFooCollection<T: TFoo> = class(TObjectDictionary<string, T>)
procedure DoSomething;
end;
它运行良好。
现在我需要像这样扩展 TFooCollection:
TBar = class( TFoo );
TBarCollection<T: TBar> = class(TFooCollection)
procedure DoSomethingElse;
end;
编译器提示TFooCollection未定义。 由于TBar从TFoo继承,我想利用TFooCollection的方法(适用于TFoo和TBar项目)并在TBar Collections中执行其他操作。
在Delphi中是否有可能实现?