[fpc-pascal] methods of an object to create others objects
andrew.t.brunner at gmail.com
Tue Jul 6 00:39:15 CEST 2010
If Memory allocation is the point of discussion and you need to create
You should nest the creations in order of usage.
In your declarations you needed bot Object1 and Object2 as TMyObject;
That said the proper usage would be:
I would like to know what the purpose is for having an auxiliary
constructor if they both reference createObj.
Anything other than nested Exception Handling is very poor practice.
On Mon, Jul 5, 2010 at 1:48 PM, Marcos Douglas <md at delfire.net> wrote:
> We can to use methods of an object to create others objects, or this
> is a bad programming practice?
> obj1, obj2: TmyObject;
> obj1 := tobj1.create; //ok
> obj2 := obj1.createObj; // is this recommended?
> Why I ask this:
> If not exists the variable obj2 in call obj1.createObj will happen a
> memory leak, right? Because there is not variable to release.
> Marcos Douglas
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal