我想扩展 MinimumDiameter 类以添加更多方法。我尝试过使用经典的 C++ 语法:
class ExtendedMinimumDiameter : public MinimumDiameter{};
ExtendedMinimumDiameter *minimumDiameter = new ExtendedMinimumDiameter(inputGeometry);
问题是当我尝试实例化我的新类的对象时,gcc-4.8.2 抱怨如下:
operators.cpp:194:92: error: no matching function for call to 'ExtendedMinimumDiameter::ExtendedMinimumDiameter(const geos::geom::Geometry*&)'
ExtendedMinimumDiameter minimumDiameter = ExtendedMinimumDiameter(inputGeometry);
^
operators.cpp:194:92: note: candidates are:
operators.cpp:116:7: note: ExtendedMinimumDiameter::ExtendedMinimumDiameter()
class ExtendedMinimumDiameter : public MinimumDiameter{
^
operators.cpp:116:7: note: candidate expects 0 arguments, 1 provided
operators.cpp:116:7: note: ExtendedMinimumDiameter::ExtendedMinimumDiameter(const ExtendedMinimumDiameter&)
operators.cpp:116:7: note: no known conversion for argument 1 from 'const geos::geom::Geometry*' to 'const ExtendedMinimumDiameter&'
为什么它不使用父构造函数,而是建议使用不带参数的默认构造函数?我的代码缺少什么?