[C++-sig] Exposing virtual functions with default implementations

Roman Yakovenko roman.yakovenko at gmail.com
Wed Apr 4 21:03:47 CEST 2007


On 4/4/07, Piotr Jaroszynski <p.jaroszynski at gmail.com> wrote:
> Hello,
>
> I am a little confused by Boost.Python tutorial about this subject - [1]. It
> is saying that I need to both override and make a default_ for a function I
> want to expose, but why is it really needed? Just the override w/o using the
> special def function seems enough - [2], [3]. What am I missing here?

It allows you to call it, even if you override the function from Python:

class X( Other ): #Other defined in extension module:
    ...
    def do_smth( self ):
        super( X, self ).do_smth( self ) #will call Other::do_smth
member function


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list