Question regarding built-in type variable is returned from a function
- by Chan
Hello,
If a local object is returned in a function call, it has to do at least three steps:
1. Copy constructor is called to hold a copy.
2. Destroy local object.
3. A copy is return.
For example:
x = y + z
If x is an integer object. A copy of y + z should be returned, then a new object is created, then assignment operator of x will take this object as parameter.
So my question is:
Is the same process used for built-in type such as int, double...? If they're not the same, how's it done?
Thanks,
Chan