方法指針妙用於線程類
unit uThread;
interface
uses
Classes,SysUtils;
Type
//Tfun = procedure;
Tfun = procedure of object;
TFunThread =Class(TThread)
private
fun:Tfun;
protected
procedure Execute;override;
public
Constructor Create(Afun:Tfun);
Destructor Destroy;override;
end;
implementation
constructor TFunThread.Create(Afun: Tfun);
begin
inherited Create(true);
FreeOnTerminate :=true;
fun:=aFun;
Resume;
end;
destructor TFunThread.Destroy;
begin
end;
procedure TFunThread.Execute;
begin
fun;
end;
end.
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/archive/2009/03/26/2940784.html