How should I free an array of objects in a Delphi 7 destructor?
问题 Suppose my Delphi classes look like this: interface type TMySubInfo = class public Name : string; Date : TDateTime; Age : Integer; end; TMyInfo = class public Name : string; SubInfo : array of TMySubInfo; destructor Destroy; override; end; implementation destructor TMyInfo.Destroy; begin // hmmm.. end; end. To properly clean up, what should go in the destructor? Is it enough to do SetLength(SubInfo,0) , or do I need to loop through and free each TMySubInfo ? Do I need to do anything at all?