unit
Unit2;
interface
type
TPoint =
class
end
;
TVector3i =
class
(TPoint)
X1, X2, X3:
Integer
;
end
;
TVector4i =
class
(TPoint)
X1, X2, X3, X4:
Integer
;
end
;
TSingle =
class
(TPoint)
X1:
Single
;
end
;
TPointClass =
class
of
TPoint;
TBaseLocations =
class
FClassIndex:
Integer
;
Location :
array
of
Integer
;
Name:
array
of
^
string
;
Value:
array
of
TPoint;
procedure
SetLengthFor(NewLength:
Integer
);
destructor
Destroy; override;
end
;
TInteger3Locations =
class
(TBaseLocations)
constructor
Create;
end
;
TInteger4Locations =
class
(TBaseLocations)
constructor
Create;
end
;
TFloat1fLocations =
class
(TBaseLocations)
constructor
Create;
end
;
var
PointsClasses:
array
[
1..3
]
of
TPointClass = (TVector4i, TVector3i, TSingle);
implementation
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
Value[i] := PointsClasses[i].Create;
New(Name[i]);
end
;
end
;
constructor
TInteger3Locations
.
Create;
begin
FClassIndex :=
2
;
end
;
constructor
TInteger4Locations
.
Create;
begin
FClassIndex :=
1
;
end
;
constructor
TFloat1fLocations
.
Create;
begin
FClassIndex :=
3
;
end
;
end
.