我有一个像这样的Generic集合:
TFoo = class;
TFooCollection<T: TFoo> = class(TObjectDictionary<string, T>)
procedure DoSomething;
end;
Run Code Online (Sandbox Code Playgroud)
它工作正常.
现在我需要像这样扩展TFooCollection:
TBar = class( TFoo );
TBarCollection<T: TBar> = class(TFooCollection)
procedure DoSomethingElse;
end;
Run Code Online (Sandbox Code Playgroud)
并且编译器抱怨没有定义TFooCollection.由于TBar继承自TFoo,我想利用TFooCollection方法(可以使用TFoo和TBar项目)并使用TBar Collections做其他事情.
德尔福有可能吗?