+ 1
C++ overload operator issues
I can not solve the issues by myself when i overload the assignment operator? Could someone help me, plz? polynomial& polynomial::operator=(const polynomial & rhs) { if (this == &rhs) { return *this; }else { delete [] coefficients; coefficients = new double[rhs.degree]; degree = rhs.degree; for (int i = 0; i < degree; i++) { coefficients[i] = rhs.coefficients[i]; // Control reaches end of non-void function } } return *this; //Control reaches end of non-void function }
0 Réponse