Marcos Douglas escreveu:
Better:

obj1 := nil;
obj2 := nil;
Try
  obj1 := TMyObject.Create;
  obj2 := TMyObject.Create;

  obj1.DoSomething1;
  obj2.DoSomething2;
finally
  obj1.Free;
  obj2.Free;
end;

The objectcs are protected. But is boring... :)
Everybody codify like that, afraid if resources are not available?
An article from today: http://www.monien.net/blog/index.php/2010/07/creating-multiple-objects-using-try-finally/

Luiz
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to