We can to use methods of an object to create others objects, or this
is a bad programming practice?
eg:
var
  obj1, obj2: TmyObject;
begin
  obj1 := tobj1.create; //ok
  obj2 := obj1.createObj; // is this recommended?
  try
  //...
  finally
    obj1.free;
    obj2.free;
  end;
end;

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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to