title: working with STL DS when it's elements are objects
body: <p>if I wanna use vector and each element is a different class (vector &lt;Product*&gt;productList)
  in that case, how do I create copy c'tor and assignment operator since each element in the vector is an object.
  I tried it the &quot;usual&quot; way, but it gave me an error E0312 and wrote to me that the conversion does not exist, I'm struggling to understand what these errors mean..</p>
  <p>also in general, when i have STL array (vector,List ...) and its elements are classes *, how do I work
   with it ?, Is it similar to the regular array and i need to take care of the deep copy, c'tor, assignment operator, etc... or it does it automatically even when the elements are dynamic classes ?</p>
  <p>thank you !</p>
  <p>as suggested i changed from vector &lt;Product*&gt;productList to vector std::shared_ptr&lt;Product&gt;productList</p>
  <pre><code>class allProduct
  {
      vector &lt;std::shared_ptr&lt;Product&gt;&gt;productList;
      int numOfProducts;
  }
  
  
  allProduct::allProduct(const allProduct&amp; other)
  {
      vector &lt;std::shared_ptr&lt;Product&gt;&gt;NewproductList;
  
      typename vector &lt;std::shared_ptr&lt;Product&gt;&gt;::iterator it = other.productList.begin();
      for (; it != other.productList.end(); it++)
      {
          NewproductList.begin() = other.productList.begin();
      }    
  }
  allProduct&amp; allProduct::operator=(const allProduct&amp; other)
  {
      numOfProducts = other.numOfProducts;
      typename vector &lt;std::shared_ptr&lt;Product&gt;&gt;::iterator it = other.productList.begin();
      for (;it !=(other.productList.end());it++)
      {
          addProduct(other.productList.begin());
          other.productList.begin()++;
      }
      return *this;
          
  }
  void allProduct::addProduct(Product* pro)
  {
      numOfProducts++;
      this-&gt;productList.push_back(pro);
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/nX9fz.png" rel="nofollow noreferrer">those are the errors im getting- E0312,E0413</a></p>