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

Roman Yakovenko roman.yakovenko at gmail.com
Thu Apr 27 12:50:20 CEST 2006


Hi.
It seems to me that I miss something very important
( or very obvious )

Here is a relevant piece of code from tutorials( http://tinyurl.com/hw5hb )

struct Base
{
    virtual ~Base() {}
    virtual int f() { return 0; }
};

struct BaseWrap : Base, wrapper<Base>
{
    int f()
    {
        if (override f = this->get_override("f"))
            return f(); // *note*
        return Base::f();
    }

    int default_f() { return this->Base::f(); }
};

class_<BaseWrap, boost::noncopyable>("Base")
    .def("f", &Base::f, &BaseWrap::default_f) ;

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?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


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



More information about the Cplusplus-sig mailing list