title: Copy Constructor in C++ is called when object is returned from a function?
body: <p>I understand copy constructor is called on three instances</p>
  
  <ol>
  <li>When instantiating one object and initializing it with values from another object.</li>
  <li>When passing an object by value.</li>
  </ol>
  
  <p><strong>3. When an object is returned from a function by value.</strong> </p>
  
  <p>I have question with no.3
  if copy constructor is called when an object value is returned, shouldn't it create problems if object is declared locally in the function.</p>
  
  <p>i mean the copy constructor is a deep copy one and takes reference of an object as parameter</p>