+ 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 }

30th Jan 2018, 12:54 AM
cheng zhang
cheng zhang - avatar
1 Answer