type TMyThread = class(TThread) private FX, FY: Integer; protected procedure Execute; override; public constructor Create(const x,y: Integer); end; { TMyThread } constructor TMyThread.Create(const x,y: Integer); begin FX := x; FY := y; inherited Create(False); end; procedure TMyThread.Execute; begin ReturnValue := FX + FY; end;
with TMyThread.Create(30, 50) do begin ShowMessage(IntToStr(WaitFor)); Free; end;