Max*_*rai 6 c++ python pure-virtual boost-python
我正在使用boost.python来生成用c ++编写的python模块.我有一些基类与纯虚函数,我已导出如下:
class Base
{
virtual int getPosition() = 0;
};
boost::python::class_<Base>("Base")
.def("GetPosition", boost::python::pure_virtual(&Base::getPosition));
Run Code Online (Sandbox Code Playgroud)
在Python中我有代码:
class Test(Base):
def GetPosition(self):
return 404
Test obj
obj.GetPosition()
Run Code Online (Sandbox Code Playgroud)
RuntimeError:调用纯虚函数
怎么了?