Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
If a function receives a reference, then it does not control its lifetime. When a function has received an object not by reference, it owns it and no one else has access to it until the function returns it or passes it somewhere. If the function did not return it and did not save it anywhere, the memory occupied by the object is freed when the function ends.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question