The copy constructors can be used to
Asked In Exam: BPSC TRE 3.0
Options
- A. Copy an object for type casting
- B. Copy an object so that it can be passed to a function
- C. Copy an object so that it can be passed to another primitive type variable
- D. Copy an object so that it can be passed to a class
Correct Answer (Detailed Explanation is Below)
B. Copy an object so that it can be passed to a function
Detailed Explanation
A copy constructor is used to create a new object as a copy of an existing object.
In C++, a copy constructor is automatically called:
When an object is passed to a function by value
When an object is returned from a function
When one object is initialized from another object