I'm using boost.python to make python-modules written in c++. I have some base class with pure virtual functions which I have exported like this:
class Base
{
virtual int getPosition() = 0;
};
boost::python::class_<Base>("Base")
.def("GetPosition", boost::python::pure_virtual(&Base::getPosition));
in Python I have code:
class Test(Base):
def GetPosition(self):
return 404
Test obj
obj.GetPosition()
RuntimeError: Pure virtual function called
What's wrong?
getPosition
(lower case g) and the Python class hasGetPosition
(upper case G). Don't know anything about Python, but maybe that does matter? – FroissartgetPosition()
missing the virtual keyword? – Disembarrass