On Friday, June 1, 2012 9:52:43 AM UTC+2, Qi wrote:
> Maybe you can dedicate your virtual function to sister
> in a multiple inheritance?
I do not really understand what you mean here...
I ``discovered'' the `delegate to sister' idiom for a few weeks
and used this in the following manner:
A is an ABS, A': virtual public A implements a concrete A.
P : virtual public A implements algorithms involving A,
and to get a concrete P we just need to let
P': public P, public A'
In this example using `delegate to sister' can be avoided by
letting P access A through a reference and this is probably
the most idiomatic way to go. Just out of curiosity,
in which sort of situations can be `the delegate to sister'
> > 2. reallyEval() is typically a private member, so
> > we need to let memoise be a friend of Btype: if memoise
> > can only be used on leaves, this is quite a lot of work.
> You can use a global accessor function to
> access reallyEval(), and let that function
> be Btypes' friend. Then all other classes
> use that accessor function.
Thank you for the tip, I did not know about it!