title: overloading addition operator
body: <p>I have a linked list that is represented as</p>
  
  <pre><code>struct term{
      double coef;
      unsigned deg;
      struct term * next;
      };
  </code></pre>
  
  <p>then i have a polynomial class</p>
  
  <pre><code>class Polynomial{
  public:
      Polynomial &amp; operator+ (const Polynomial &amp; ) const;
  private:
      term *ptr
  </code></pre>
  
  <p>and i am trying to do an addition overloaded operator, but what i tried just give me some random part of the polynomial that is in the middle.</p>
  
  <pre><code>Polynomial &amp; Polynomial::operator+(const Polynomial &amp; poly) const{
      Polynomial p2 = *this;
      term * temp = (*this).ptr;
      while(temp-&gt;next != NULL){
          temp = temp-&gt;next;
      }
      temp-&gt;next = poly.ptr;
      return p2;
  }
  </code></pre>
  
  <p>and also when i have 2 polynomials, one is a copy of another just then added one more term, then when i try to use the addition operator, the first polynomial is bigger, like the second polynomial is added to it. </p>