[fpc-pascal] question with interfaces, hooks
pascaldragon at googlemail.com
Wed Jul 15 08:05:27 CEST 2015
Am 15.07.2015 06:07 schrieb "David Emerson" <dle3ab at angelbase.com>:
> constructor t_fancy_class.create;
> f_hook := t_foo_base.create;
> destructor t_fancy_class.destroy;
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal