[fpc-pascal] methods of an object to create others objects

Luiz Americo Pereira Camara luizmed at oi.com.br
Tue Jul 6 17:56:38 CEST 2010


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



More information about the fpc-pascal mailing list