What happens when an object is passed by reference?
Options
- A. Destructor is called when called explicitly
- B. Destructor is called at end of function
- C. Destructor is not called
- D. Destructor is called when function is out of scope
C. Destructor is not called
In C++, when an object is passed by reference, no new copy of the object is created.
Since no new object is created:
The copy constructor is not called
The destructor is not called at the end of the function
The function simply works with the original object.
Attempt Quiz Now:
BPSC Tre 4.0 OOPS Concepts Practice Set