Which constructor is called while assigning some object with another?

Which constructor is called while assigning some object with another?
A. Default
B. Parameterized
C. Copy
D. Direct assignment is used
 
Answer: c
Explanation: Copy constructor is used while an object is assigned with another. This is mandatory since we can’t decide which member should be assigned to which member value. By using copy constructor, we can assign the values in required form.
 

Tìm kiếm

Back
Top