On 05/03/2012 09:18 PM, Gor Gyolchanyan wrote:
So, you're saying, that the foo function actually takes the *this,
which we ass manually, extracts the real foo method and calls it?
AFAIK, that shouldn't be the case. The delegate extracts the A's foo
and call to the delegate should be a direct call to A.foo, not a
virtual call.


I just gave an alternative to Alex' solution, but it seems both do not actually do what you are after.

Is this good enough?

auto fn = function(A a){return a.foo();}

fn(a);
fn(b);

Reply via email to