type
TPairedList = class(TStringList)
private
FBuddy: TStrings;
protected
procedure ExchangeItems(Id1, Id2: Integer); override;
public
procedure Sort(Buddy: TStrings); overload;
end;
procedure TPairedList.ExchangeItems(Id1, Id2: Integer);
begin
inherited Exchange(Id1, Id2);
if Assigned(FBuddy) then
FBuddy.Exchange(Id1, Id2);
end;
procedure TPairedList.Sort(Buddy: TStrings);
begin
FBuddy := Buddy;
Sort;
end;
begin
...
a.sort(b);
end.