J
javesun
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟想在线程中创建子线程,但是在编译时提示“Abstrac Error”。程序如下。
type
TCThread= Class(TThread)
private
FTabStr: String;
FStatus: String;
protected
procedure Execute;
override;
public
Constructor Create;
end;
type
TMThread= Class(TThread)
private
FNRCThread: Array of TCThread;
protected
procedure Execute;
override;
public
Constructor Create;
procedure Suspend;
end;
implementation
{ TCThread }
constructor TCThread.Create;
begin
inherited Create(True);
----->出错句
FreeOnTerminate:= True;
end;
procedure TCThread.Execute;
begin
inherited;
while not Terminateddo
begin
//
end;
end;
{ TMThread }
constructor TMThread.Create;
var
i: Integer;
begin
inherited Create(False);
FreeOnTerminate:= True;
SetLength(FNRCThread, 3);
for i:= Low(FNRCThread) to High(FNRCThread)do
FNRCThread:= TCThread.Create;
end;
procedure TMThread.Execute;
begin
inherited;
while not Terminateddo
begin
//
end;
end;
procedure TMThread.Suspend;
begin
//
end;
MThread创建时,在创建子线程的时候提示错误“Abstract Error”。
type
TCThread= Class(TThread)
private
FTabStr: String;
FStatus: String;
protected
procedure Execute;
override;
public
Constructor Create;
end;
type
TMThread= Class(TThread)
private
FNRCThread: Array of TCThread;
protected
procedure Execute;
override;
public
Constructor Create;
procedure Suspend;
end;
implementation
{ TCThread }
constructor TCThread.Create;
begin
inherited Create(True);
----->出错句
FreeOnTerminate:= True;
end;
procedure TCThread.Execute;
begin
inherited;
while not Terminateddo
begin
//
end;
end;
{ TMThread }
constructor TMThread.Create;
var
i: Integer;
begin
inherited Create(False);
FreeOnTerminate:= True;
SetLength(FNRCThread, 3);
for i:= Low(FNRCThread) to High(FNRCThread)do
FNRCThread:= TCThread.Create;
end;
procedure TMThread.Execute;
begin
inherited;
while not Terminateddo
begin
//
end;
end;
procedure TMThread.Suspend;
begin
//
end;
MThread创建时,在创建子线程的时候提示错误“Abstract Error”。