Open In App

C++ | References | Question 6

Like Article
Like
Save
Share
Report

Which of the following functions must use reference.
(A) Assignment operator function
(B) Copy Constructor
(C) Destructor
(D) Parameterized constructor


Answer: (B)

Explanation: A copy constructor is called when an object is passed by value. Copy constructor itself is a function. So if we pass argument by value in a copy constructor, a call to copy constructor would be made to call copy constructor which becomes a non-terminating chain of calls. Therefore compiler doesn’t allow parameters to be pass by value.

See https://www.geeksforgeeks.org/copy-constructor-in-cpp/ for details.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads