[C++-sig] Fwd: Virtual Functions with Default Implementations

Alex Mohr amohr at pixar.com
Thu Apr 27 18:34:05 CEST 2006


> Why boost.python requests to register BaseWrap::default_f?
> It seems to me that BaseWrap::f implementation deals with this.
> 
> So what did I miss?

I think it's so you can call Base's f() from your derived, overridden f 
without an infinite loop.  Something like this:

class Dervied(Base):
     def f(self):
         return Base.f(self) * 2

Here I don't want my Base.f(self) call to dispatch back to me, as this 
would cause an infinite recursion.

Alex



More information about the Cplusplus-sig mailing list