我们有以下课程。我需要解释代码的某些部分。
class CPoint3D
{
public:
double x, y, z;
CPoint3D (double dX = 0.0, double dY = 0.0, double dZ = 0.0)
: x(dX), y(dY), z(dZ) {}
//what means these lines of code?
CPoint3D operator + (const CPoint3D& point) const;
CPoint3D operator - (const CPoint3D& point) const;
CPoint3D operator * (double dFactor) const;
CPoint3D operator / (double dFactor) const;
};
我猜使用
CPoint3D operator + (const CPoint3D& point) const;
函数我可以轻松地添加/减去/乘/除类的实例CPoint3D
?
有人可以用例子来解释吗?谢谢!