Код:
unit Unit1;
interface
type
TPoint = class
end;
TVector3i = class(TPoint)
X1, X2, X3: Single;
end;
TVector4i = class(TPoint)
X1, X2, X3, X4: Single;
end;
TSingle = class(TPoint)
X1: Single;
end;
TBaseLocations = class
Location : array of Integer;
Name: array of ^string;
Value: array of TPoint;
procedure SetLengthFor(NewLength: Integer);
procedure AddValue(Index: Integer); virtual; abstract;
destructor Destroy; override;
end;
TInteger3Locations = class(TBaseLocations)
procedure AddValue(Index: Integer); override;
end;
TInteger4Locations = class(TBaseLocations)
procedure AddValue(Index: Integer); override;
end;
TFloat1fLocations = class(TBaseLocations)
procedure AddValue(Index: Integer); override;
end;
implementation
{ TBaseLocations }
destructor TBaseLocations.Destroy;
var
I: Integer;
begin
for I := Low(Value) to High(Value) do
Value[i].Free;
inherited;
end;
procedure TBaseLocations.SetLengthFor(NewLength: Integer);
var
I: Integer;
begin
SetLength(Location, NewLength);
SetLength(Name, NewLength);
SetLength(Value, NewLength);
for I := 0 to NewLength - 1 do begin
AddValue(I);
New(Name[i]);
end;
end;
{ TInteger3Locations }
procedure TInteger3Locations.AddValue(Index: Integer);
begin
Value[Index] := TVector3i.Create;
end;
{ TInteger4Locations }
procedure TInteger4Locations.AddValue(Index: Integer);
begin
Value[Index] := TVector4i.Create;
end;
{ TFloat1fLocations }
procedure TFloat1fLocations.AddValue(Index: Integer);
begin
Value[Index] := TSingle.Create;
end;
end.
Что-то типа этого, классы TVector3i, TVector4i и т.д. уж не знаю, как там у вас выглядят. Весь смысл в том, чтобы унаследовать их всех от одного класса TPoint (я понял, что это у вас точки в пространствах разной размерности).