[C++-sig] Inheritance question

Stefan Seefeld seefeld at sympatico.ca
Fri Feb 10 17:01:12 CET 2006

Koen Van Herck wrote:

> With 'expose' I meant using the class from Python. I didn't show the module
> definition,
> which follows Boost.Python's tutorial for virtual functions:
> BOOST_PYTHON_MODULE(inheritance)
> {
>     class_<BaseWrap, boost::noncopyable>("Base")
>         .def("f", pure_virtual(&Base::f))
>     ;

Ok, you expose 'BaseWrap', not 'Base'. I think you should still be able
to expose 'Derived' with 'bases<Base>' without problems. See
boost/libs/python/test/polymorphism2.cpp for where this is used / tested.


More information about the Cplusplus-sig mailing list