项目引发异常类抽象错误消息“抽象错误”

时间:2017-09-11 16:37:36

标签: delphi

我有父类TPerDevice,它有虚拟abstarct方法“doAction”,子类TPerPrnDevice覆盖“doAction” 有没有人知道我为什么得到abstarct异常? 谢谢 "Abstract Error'

type
  TPerDevice = class(TThread)
  public
    function    doAction(oPrm:String):String; virtual; abstract;
  end;

type 
  TPerPrnDevice = class(TPerDevice)
  public
    //function    doAction(oPrm:String):String;
  end;

type
  TxchPrn = class(TPerPrnDevice)
    function    doAction(oPrm:String):String;override;
    procedure   doLocalJob(oPrm:String);
  end;

...

function TxchPrn.doAction(oPrm: String): String;
begin
     doLocalJob(oPrm);
end;

procedure TForm1.Button1Click(Sender: TObject);
VAR Devices: array of TPerDevice;
begin
    SetLength(Devices,2);
    Devices[0]:=TxchPrn.Create;
    Devices[0].doAction('Print');
end;

procedure TxchPrn.doLocalJob(oPrm: String);
begin
 ShowMessage(oPrm);
end;

1 个答案:

答案 0 :(得分:4)

您忘记实现线程执行方法Execute