关于类继承 虚函数 方面的问题
interface IObject
{
public:
virtual IObject* clone() throw (NotSupportedException) = 0;
// return a new object that is an exact copy of this one.
// IMPORTANT: do not return the this pointer!
virtual ~IObject() {}
}; // IObject
class Point : public IObject, public virtual IShape
{
public:
Point();
Point(const double* pCoords, unsigned long dimension);
Point(const Point& p);
virtual ~Point();
virtual Point& operator=(const Point& p);
virtual bool operator==(const Point& p) const;
//
// IObject interface
//
virtual Point* clone() throw (NotSupportedException);
/*
中间省略了一些代码
*/
}
编译通不过
报错如下:
error C2555: 'Tools::Geometry::Point::clone' : overriding virtual function differs from 'Tools::IObject::clone' only by return type or calling conventi
这个代码在vc7先是能编译通过的,
我改放在vc6下就编译通不过!
我在使用开源的spatialindex
但只有gcc下编译的版本,在vc6下不能使用,
谁有spatialindex在vc6下编译的代码吗?
发现语法上有很多不同!