[C++-sig] Confusion about inheritance with boost.python
David Abrahams
dave at boost-consulting.com
Tue Oct 3 17:37:23 CEST 2006
Noah Schwartz <noah.schwartz1 at gmail.com> writes:
> struct AWrap : A, wrapper<A> {
> int f() {
> return 0;
> }
> };
>
> BOOST_PYTHON_MODULE(libnn)
> {
> class_<AWrap, boost::noncopyable>("A")
> .def("f", pure_virtual(&A::f))
> ;
> }
This doesn't look right. If A::f is supposed to be exposed as pure
virtual, you shouldn't be overriding it in AWrap.
> However when I load my module in python I get a complaint about the
> undefined symbol A.
Please post the complete text of the complaint. In fact, please also
post a reproducible example containing one C++ file and one Python
file.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list