Hi,
I'm trying to use Boost.Python to create an extension module based on
some existing code. Therein I have a class hierarchy which I would
like to expose in a way that would make it possible to subclass any of
its classes in python. I run into a problem when I try to expose C++
functions which return pointers to the base class of the hierarchy.
In the minimal example I am using for testing purposes I have:
// An abstract base class
class abstract {
...
virtual void thing() const = 0;
};
// A conctrete subclass implemented in C++
class concrete : public abstract {
...
virtual void thing const { ... }
};
// Callback to allow happy subclassing of abstract in python
class abstract_callback : public abstract { ... };
// Callback to allow happy subclassing of concrete in python
class concrete_callback : public abstract { ... };
BOOST_PYTHON_MODULE_INIT(abstract) {
...
python::class_builder