且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

向量< double>的*,+,-'运算符重载.班级

更新时间:2023-11-10 12:31:34

您必须在全局范围内重载运算符:

You have to overload the operators at global scope:

vector<double> operator*(const vector<double>& v, double alfa)
{
    ...
}

vector<double> operator+(const vector<double>& v1, const vector<double>& v2)
{
    ...
}

vector<double> operator-(const vector<double>& v1, const vector<double>& v2)
{
    ...
}

对于链接器错误,似乎您没有实现Line构造函数和析构函数.

As for the linker errors, it just looks like you didn't implement the Line constructor and destructor.