[fpc-pascal] interface inheritance implementation
David Emerson
david at angelbase.com
Tue Oct 13 03:34:30 CEST 2015
On 10/12/2015 03:13 AM, Graeme Geldenhuys wrote:
> t_multiplier_and_adder = class (tbase, i_adder, i_multiplier)
Thanks for this recommendation-- the problem is that I have a list whose
elements are each i_multiplier_and_adder, and I want to be able to take
an element of that list and have the full capability. So separating
i_multiplier from i_adder creates a different problem.
The other recommendation was essentially to make a proper delegate that
is not an instance of the ancestor interface. But that doesn't work for
me, because -- as I wrote initially -- I have one instance of the
ancestor, and multiple instances of the child that need to work
differently for their own stuff but all call on the one singular
ancestor instance for its interface.
So far I have not figured out how to typecast an interface into its
implementing class, which would be an alternate solution for my
particular situation.
For the time being, I guess there's no shortcut - I just have to
implement all of the i_adder methods in i_multiplier_and_adder, and have
them call the same method in the "hook" which is unable to be a delegate.
Thanks for your responses, all!
~David.
More information about the fpc-pascal
mailing list