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:

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 (t_current_volume = t_volumes [index]) then
    t_volumes [index].Destroy;
  SetLength (t_volumes, last);
end;

This produces bad results, as it currently sits. What am I doing wrong?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to