Hi,

   gtree.TTree type has the following code:

constructor TTree.Create;
begin
  FRoot := nil;
end;

destructor TTree.Destroy;
begin
  FRoot.Free;
end;


How is possible then that the following program don't raise an error
when the destructor (via free) is called?


program Project1;
{$mode objfpc}{$H+}
uses
  Classes, gtree;
type
    TStrTree = specialize TTree<String>;
var
   tt: TStrTree;
begin
     tt:=TStrTree.Create;
     if tt.Root = nil
     then
         WriteLn('Root is nil!');
     tt.Free;
end.

Thanks,

       Daniel
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to