When an object is passed to a function, its copy is made in the function and then ______________

When an object is passed to a function, its copy is made in the function and then ______________
A. The destructor of the copy is called when function is returned
B. The destructor is never called in this case
C. The destructor is called but it is always implicit
D. The destructor must be user defined
 
Answer: a
Explanation: When an object is passed to a function, its copy is made in the function. This copy acts as a real object till the function is live. When the function is returned, the copy’s destructor is called to free the resources held by it.
 

Tìm kiếm

Back
Top