C++ cli 调用重载运算符函数

C++ cli 调用重载运算符函数,c++-cli,C++ Cli,我有重载函数 Vector3D^ Vector3D:: operator + (Vector3D^ toAdd) // Adding 2 vectors { Vector3D^ temp = gcnew Vector3D(); temp->x = x + toAdd->x; temp->y = y + toAdd->y; temp->z = z + toAdd->z; return temp; } 但每当我打电话

我有重载函数

 Vector3D^ Vector3D:: operator + (Vector3D^ toAdd)  // Adding 2 vectors
{
    Vector3D^ temp = gcnew Vector3D();
    temp->x = x + toAdd->x;
    temp->y = y + toAdd->y;
    temp->z = z + toAdd->z;
    return temp;
}
但每当我打电话

double x1 = Convert::ToDouble(txtAx->Text);
double x2 = Convert::ToDouble(txtBx->Text);
double y1 = Convert::ToDouble(txtBx->Text);
double y2 = Convert::ToDouble(txtBx->Text);
double z1 = Convert::ToDouble(txtBx->Text);
double z2 = Convert::ToDouble(txtBx->Text);

Vector3D vectorA(x1, y1, z1);
Vector3D vectorB(x2, y2, z2);
Vector3D temp;

temp = vectorA + vectorB;

我得到了一个no运算符来匹配这些函数错误。每个网站都建议这样做。

我对名字中的<代码> ^ <代码>感到困惑。@ C++:这不是C++。它是C++/CLI。这就是为什么。@LightnessRacesinOrbit不明白。它们是两个向量,有双倍x y z,可能是