L
lhxs
Unregistered / Unconfirmed
GUEST, unregistred user!
unit SortThds;
interface
uses
Classes, Graphics, ExtCtrls;
type
{ TSortThread }
PSortArray = ^TSortArray;
TSortArray = array[0..MaxInt div SizeOf(Integer) - 1] of Integer;
TSortThread = class(TThread)
private
FBox: TPaintBox;
FSortArray: PSortArray;
FSize: Integer;
FA, FB, FI, FJ: Integer;
proceduredo
VisualSwap;
protected
procedure Execute;
override;
procedure VisualSwap(A, B, I, J: Integer);
procedure Sort(var A: array of Integer);
virtual;
abstract;
public
constructor Create(Box: TPaintBox;
var SortArray: array of Integer);
end;
{ TBubbleSort }
TBubbleSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
{ TSelectionSort }
TSelectionSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
{ TQuickSort }
TQuickSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
上面的 procedure Sort(var A: array of Integer);
virtual;
abstract;这个虚拟函数与 TQuickSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
有什么区别,为什么要这样做?
interface
uses
Classes, Graphics, ExtCtrls;
type
{ TSortThread }
PSortArray = ^TSortArray;
TSortArray = array[0..MaxInt div SizeOf(Integer) - 1] of Integer;
TSortThread = class(TThread)
private
FBox: TPaintBox;
FSortArray: PSortArray;
FSize: Integer;
FA, FB, FI, FJ: Integer;
proceduredo
VisualSwap;
protected
procedure Execute;
override;
procedure VisualSwap(A, B, I, J: Integer);
procedure Sort(var A: array of Integer);
virtual;
abstract;
public
constructor Create(Box: TPaintBox;
var SortArray: array of Integer);
end;
{ TBubbleSort }
TBubbleSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
{ TSelectionSort }
TSelectionSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
{ TQuickSort }
TQuickSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
上面的 procedure Sort(var A: array of Integer);
virtual;
abstract;这个虚拟函数与 TQuickSort = class(TSortThread)
protected
procedure Sort(var A: array of Integer);
override;
end;
有什么区别,为什么要这样做?