title: Implementing a polynomial in c++ with overloading operator + on constructors
body: <p>A class Poly is constructed to create and do operations on polynomial. Vectors are used to store exponents and coefficients. Poly(int,int) is a constructor to initialize values of coefficient and exponent of a particular term. Obviously, a polynomial will have more than one term. So, i am planning to use Poly c = Poly(3,4) + Poly(2,2) + Poly(7,1) + Poly(-5,0); to initialize more than one term and add all coefficients and exponents to the vectors which will have exponents and coefficients for a single Poly object with multiple terms.</p>
  <pre><code>class Poly
  {
      // for writing polynomials
      // friend ostream &amp;operator&lt;&lt;(ostream &amp;Out, const Poly &amp;F);
      // private data and functions
  private:
      // coefficient of a term in polynomial
      int term_coefficient;
      // exponent of a term in polynomial
      int term_exponent;
      // public data and functions
  public:
      // coefficients of the polynomial
      vector&lt;int&gt; C;
      // exponents of the polynomial
      vector&lt;int&gt; E;
      // constructor for default polynomial
      Poly()
      {
      }
      // constructor for polynomial with arguments
      Poly(int c, int e)
      {
          term_coefficient=c;
          term_exponent=e;
          vector&lt;int&gt;::iterator it;
          int size_of_e_vector;
          int size_of_c_vector;
          size_of_e_vector = E.size();
          size_of_c_vector = C.size();
          if(size_of_e_vector!=0)
          {
              cout&lt;&lt;&quot;There exists previous values&quot;&lt;&lt;endl;
              // cout&lt;&lt;&quot;At Exponent: &quot;&lt;&lt;term_exponent&lt;&lt;&quot;, Exponent Value is: &quot;&lt;&lt;E.at(term_exponent)&lt;&lt;endl;
          }
          else
          {
              // cout&lt;&lt;&quot;The Exponent Vector is Empty&quot;&lt;&lt;endl;
              it = E.begin() + term_exponent;
              E.insert(it, term_exponent);
              C.insert(it, term_coefficient);
              cout&lt;&lt;&quot;In Exponent Vector, the Value is: &quot;&lt;&lt;E.at(term_exponent)&lt;&lt;&quot;, and in Coefficient Vector, the Value is: &quot;&lt;&lt;C.at(term_exponent)&lt;&lt;endl;
          }
      }
      // copy constructor
      /*
      Poly(const Poly &amp; rhs)
      {
  
      }
      */
      // destructor
      ~Poly()
      {
      }
      // overloaded operators (members)
      // Poly &amp; operator+=(const Poly &amp; rhs);
      // Poly operator+(Poly(int &amp; co1, int &amp; ex1));
  };
  
  // overloaded operators (non-members)
  Poly operator+(Poly::Poly(int &amp; co1, int &amp; ex1), Poly::Poly(int &amp; co2, int &amp; ex2));
  
  Poly operator+(Poly::Poly(int &amp; co1, int &amp; ex1), Poly::Poly(int &amp; co2, int &amp; ex2))
  {
     if(ex1!=ex2)
      {
          // put co2 in C vector and ex2 in E vector
          // assuming co1 is already in C vector and ex1 already in E vector
          // if not push co1 and ex1 too   
      }
  }
  </code></pre>
  <p>How to overload + such that
  Poly c = Poly(3,4) + Poly(2,2) + Poly(7,1) + Poly(-5,0);
  writing this is possible?
  Please Note : I am not overloading + on objects but i want to work on constructors.</p>
  <pre><code>int main()
  {
      Poly c = Poly(3,4) + Poly(2,2) + Poly(7,1) + Poly(-5,0);
      // cout&lt;&lt;c.term_exponent&lt;&lt;endl;
      return 0;
  }
  </code></pre>