相关疑难解决方法(0)

如何继承通用的虚方法?

我有以下代码.我想覆盖基础列表的Notify方法,以便能够在修改列表时创建一个事件.

  TDescendantList = class(TObjectList<TSomeclass>)
  private
    <...>
  protected
    procedure Notify(const Value: T;
      Action: TCollectionNotification); override;
    <...>
  end;
Run Code Online (Sandbox Code Playgroud)

如果我把Value: T我在T上得到一个"未声明的标识符".

如果Value: TSomeClass我得到"通知声明"与以前的声明不同".

Notify是一种受保护的方法TObjectList<T: class>.此方法不会出现在XE2 IDE的重写列表中.

这是实现这个的一些方法,或者我需要使用另一种方法,因为这是一个众所周知的砖墙?

delphi generics inheritance delphi-xe2

7
推荐指数
1
解决办法
460
查看次数

标签 统计

delphi ×1

delphi-xe2 ×1

generics ×1

inheritance ×1