I have a module with a C++ class exposed:
class MyClass{
public:
MyClass(){}
void foo(){
//...
}
};
BOOST_PYTHON_MODULE(my_module){
class_<MyClass>("MyClass", init<>())
.def("foo", &MyClass::foo)
;
}
In Python, I create a class that is derived from this class.
from my_module import *
class Derived(MyClass):
def __init__(self):
self.foo()
d = Derived()
I get the error:
Boost.Python.ArgumentError: Python argument types in
MyClass.foo(Derived)
did not match C++ signature:
foo(class MyClass {lvalue})
I expected to be able to call a function defined in the base class from the derived class. How can I fix this?