On Tue, Jul 6, 2010 at 12:56 PM, Luiz Americo Pereira Camara <luiz...@oi.com.br> wrote: > 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/
Ok! Well... sincerely I only use this method when I not know if an object will be instanced or not (depends of algorithm). Marcos Douglas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal