On Thu, Oct 6, 2016 at 11:57 AM, Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote: > Hello Marcos, > > On 2016-10-06 at 11:25, Marcos Douglas wrote: > >> you need to declarate >> two variables to do one job. >> I don't like that and I think shouldn't be necessary. > > Well, to be fair, that example is not representative of a real-world > application. In a real-world app, I would not declare and release > objects and interface references like than - in the same procedure.
Yes of course, I know. You will do some like that: constructor TFoo.Create; begin FTheObject := TBar.Create; // implements ITheObject end; destructor TFoo.Destroy; begin FTheObject.Free; end; procedure TFoo.Execute; begin CallSomethingThatAcceptsAnInterface(FTheObject); end; Nothing wrong. But you needs to create TFoo and manage it. Regards, Marcos Douglas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal