title: Why ampersand is used in copy constructor?
body: <p>Why do we pass object of a class by reference. When I remove ampersand (&amp;) I get following error.</p>
  
  <pre><code>"Copy constructor of class A may not have parameter of type A"
  </code></pre>
  
  <p>What does this mean? may be compiler is not considering given a copy constructor and using default one.If this is that case why default one is being called. In short why we use ampersand and what will happen? if we don't.</p>
  
  <pre><code>class A
  {
  public:
      A()
      {
  
      }
  
  
  
      A(A&amp; tmp)
      {
          id = 2*tmp.id;
      }
  
  public:
      int id;
  };
  
  
  int main()
  {
      A obj;
      obj.id = 10;
  
      A obj1(obj);  
      cout &lt;&lt; obj1.id;
  }
  </code></pre>