when can we use copy constructor?

Answer Posted / sagarson

Copy constructors are called in following cases:
a) when a function returns an object of that class by value
b) when the object of that class is passed by value as an
argument to a function
c) when you construct an object based on another object of
the same class
d) When compiler generates a temporary object

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....

2168


What is == in programming?

780


Do we have to use initialization list in spite of the assignment in constructors?

750


What does obj stand for?

823


Does c++ support multilevel and multiple inheritances?

725






Incase of a function declaration, what is extern means?

700


What is struct c++?

731


Are c and c++ different?

711


What is meant by iomanip in c++?

819


Is arr and &arr are same expression for an array?

791


Define what is constructor?

784


Define pre-condition and post-condition to a member function in c++?

871


What are the uses of static class data?

850


Is java based off c++?

709


What is the difference between structure and class?

782