title: C++ Cannot Convert parameter from '*type' to 'const type &'
body: <p>The following operation is part of a cash register machine.   </p>
  
  <p>In order to generate a bill I should count the products:<br>
  1. Each product is added once to the bill.<br>
  2. In case the product is already exist in this bill, its quantity is incremented.</p>
  
  <pre><code>void CashRegister::countProducts()
  {
  OMIterator&lt;Product*&gt; iter(itsProduct);
  CountedProduct* cp;
  Product* p;
  
  // Iterate through all products counting them
  while (*iter) {
    // get the next product
    p = *iter;
  
    // has this already been added?
    cp = getItsCountedProduct(p-&gt;getBarcode());
  
    // If it does not exist then add it else increment it
    if (NULL==cp) {
      addItsCountedProduct(p-&gt;getBarcode(), new CountedProduct(p));
    } else {                                                       
      cp-&gt;increment();
    }                 
    // point to next
    ++iter;
  }    
  </code></pre>
  
  <p>and:    </p>
  
  <pre><code>void CashRegister::addItsCountedProduct(int key, CountedProduct* p_CountedProduct) 
  {
  if(p_CountedProduct != NULL)
      {
          NOTIFY_RELATION_ITEM_ADDED("itsCountedProduct", p_CountedProduct, false, false);
      }
  else
      {
          NOTIFY_RELATION_CLEARED("itsCountedProduct");
      }
  itsCountedProduct.add(key,p_CountedProduct);
  </code></pre>
  
  <p>}</p>
  
  <p>I get the following error:<br>
  <strong>error C2664: 'CountedProduct::CountedProduct' : cannot convert parameter 1 from 'Product *' to 'const CountedProduct &amp;'</strong>  </p>
  
  <p>The error is references to this line:<br>
  <code>addItsCountedProduct(p-&gt;getBarcode(), new CountedProduct(p));</code></p>
  
  <p>Any ideas?</p>