Can anyone tell me why the overloaded += operator is not advancing through the linked lists if the lists have a different number of nodes?
Posted on 2009-04-28
I am trying to figure this out. I need to get this done pronto so any help is appreciated.
Here is the outline of my assignment:
Define and implement a class named Polynomial that has operators for creating a polynomial, reading a polynomial, and adding and subtracting polynomials. Its partial declaration is given below (you can add some other auxiliary member functions to the class, if necessary).
// default constructor: create an empty polynomial
// copy constructor: use the content of p1 to create a polynomial
Polynomial(const Polynomial& p1);
// release dynamic memory related to the polynomial
// overloaded assignment operator
// assign the content of p1 to a polynomial
void operator=(const Polynomial& p1);
// overloaded += operator
// add a polynomial
void operator+=(const Polynomial& p1);
// overloaded -= operator
// subtract a polynomial
void operator-=(const Polynomial& p1);
// read a polynomial
// output a polynomial