Am 15.07.2015 06:07 schrieb "David Emerson" <dle...@angelbase.com>:
[snip]
> constructor t_fancy_class.create;
>   begin
>     inherited;
>     f_hook := t_foo_base.create;
>   end;
>
> destructor t_fancy_class.destroy;
>   begin
>     t_foo_base(f_hook).free;
>     inherited;
>   end;
[snip]

Not related to your problem, but important nevertheless: you don't need to
free interface variables. They are reference counted an freed automatically
at least if you don't mix a class reference (in your case to t_foo_base)
and interface reference (in your case i_foo) which you shouldn't do anyway
(and which you aren't doing in your example).

I haven't work with delegation much, but you could try to do "(fc as
i_foo).foo;". Also you might want to take a look at TAggregatedObject.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to