On 13-11-15 07:57 PM, Timothy Groves wrote:
How exactly are instantiated classes treated in an array? Can I copy
one into another? And if I unallocate an array member, does it
automatically Destroy the object?
I have objects stored in a dynamic array, and I want to delete an
arbitrary record. What I have right now is:
<snip incorrectly pasted code>
This produces bad results, as it currently sits. What am I doing wrong?
Here's the code I *actually* have in the method:
var
index,
last : integer;
begin
last := length (t_volumes) - 1;
index := 0;
while ((t_volumes [index] <> t_current_volume) and (index < last)) do
inc (index);
if (index < last) then begin
t_volumes [index] := t_volumes [last];
t_volumes [last].Destroy;
end;
SetLength (t_volumes, last);
end;
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal