我在下面定义了一个基类测试
type
Tinfo = procedure of object;
Test = class(TObject)
public
procedure Add ( const a : Tinfo ); reintroduce ;
end;
procedure Test.Add(const a: Tinfo);
begin
Writeln('base class add function');
// dosomething more
end;
我有一个从这个基类派生的泛型类
TTesting<T> = class(Test)
public
procedure Add ( const a : T ); reintroduce ;
end;
我正在类型转换T
,Tinfo
但它给了我错误
procedure TTesting<T>.Add(const a : T );
begin
inherited Add(Tinfo(a) ); // gives me error here
end;
有什么办法可以实现吗?