相关疑难解决方法(0)

我如何确定是否实现了抽象方法?

我使用的是一个非常大的delphi第三方库,没有源代码,这个库有几个带抽象方法的类.我需要确定运行时Descendant类实现abtract方法的时间,以避免EAbstractError: Abstract Error向用户显示自定义消息或使用其他类代替.

例如,在此代码中,我想在运行时检查是否MyAbstractMethod已实现.

type
  TMyBaseClass = class
  public
    procedure MyAbstractMethod; virtual; abstract;
  end;

  TDescendantBase = class(TMyBaseClass)
  public
  end;

  TChild = class(TDescendantBase)
  public
    procedure MyAbstractMethod; override;
  end;

  TChild2 = class(TDescendantBase)
  end;
Run Code Online (Sandbox Code Playgroud)

我如何确定在运行时的Descendant类中是否实现了抽象方法?

delphi delphi-xe

10
推荐指数
3
解决办法
2597
查看次数

标签 统计

delphi ×1

delphi-xe ×1