以下是我的C++ class
namespace X {
class ChildFactory: public Father {
public:
static ChildFactor* createChildFactory(const properties* ptr = NULLPTR);
private :
// no instances allowed
ChildFactory();
ChildFactory(const properties* ptr);
~ChildFactory();
};
};
以下是我定义Boost::Python
构造的方式。
BOOST_PYTHON_MODULE(TestPy)
{
boost::python::class_<X::ChildFactory, boost::noncopyable>("ChildFactory")
.def("createChildFactory", &X::ChildFactory::createChildFactory, boost::python::return_value_policy<boost::python::manage_new_object>() )
.staticmethod("createChildFactory")
;
}
但它给了我奇怪的编译器模板错误。
错误是
destructor could not be generated because a base class destructor is inaccessible