I understand copy constructor is called on three instances
- When instantiating one object and initializing it with values from another object (as in the example above).
- When passing an object by value.
3. When an object is returned from a function by value.
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.
i mean the copy constructor is a deep copy one and takes reference of an object as parameter