no matching function for call to ' '

前端 未结 2 1493
旧时难觅i
旧时难觅i 2020-12-17 11:07

I was given to implement the function:

 \"static double distanta (const Complex&, const Complex&);\"

which return the distance betw

2条回答
  •  时光说笑
    2020-12-17 11:34

    You are trying to pass pointers (which you do not delete, thus leaking memory) where references are needed. You do not really need pointers here:

    Complex firstComplexNumber(81, 93);
    Complex secondComplexNumber(31, 19);
    
    cout << "Numarul complex este: " << firstComplexNumber << endl;
    //                                  ^^^^^^^^^^^^^^^^^^ No need to dereference now
    
    // ...
    
    Complex::distanta(firstComplexNumber, secondComplexNumber);
    

提交回复
热议问题