[C++-sig] How to derive from an abstract base class

Lutz Maibaum lutz.maibaum at gmail.com
Sat Jul 24 01:19:24 CEST 2010


On Jul 23, 2010, at 3:55 PM, Jim Bosch wrote:
> Try this:
> 
> BOOST_PYTHON_MODULE(foo) {
>    class_<BaseWrap, boost::noncopyable>("Base")
>      .def("f", pure_virtual(&Base::f));
>    class_<Derived, bases<Base>  >  ("Derived")
>      .def("f",&Derived::f);
>    def("func", func, "Calls the method f of its argument");
> }
> 
> (just swap the order of the class_ statements)

Fantastic! That works like charm.

Thank you very much,

  Lutz



More information about the Cplusplus-sig mailing list