[fpc-pascal] methods of an object to create others objects
md at delfire.net
Tue Jul 6 17:31:59 CEST 2010
On Tue, Jul 6, 2010 at 12:10 PM, Andrew Brunner
<andrew.t.brunner at gmail.com> wrote:
>> Hum... I do not agree. Why not this? See..
> In your example, if obj2:=TMyObject.Create fails (which will happen if
> resources are not available)... then the exception is raised and Obj1
> never gets freed. So in an example where this method is re-entrant,
> you would see many instances of this occurring.
obj1 := nil;
obj2 := nil;
obj1 := TMyObject.Create;
obj2 := TMyObject.Create;
The objectcs are protected. But is boring... :)
Everybody codify like that, afraid if resources are not available?
More information about the fpc-pascal