Answer Posted / namitha
A copy constructor is used in the following cases.
-When an object is created from another object of the same
type.
-When an object is passed by value as a parameter to a
function.
-When an object is returned from a pointer.
-when we want to set a default value for the data members.
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
In what situations do you have to use initialization list rather than assignment in constructors?
Which format specifier is used for printing a pointer value?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
What is the type of this pointer in c++?
What are exceptions c++?
How do you print a string on the printer?
What is the best book for c++ beginners?
How to get the current position of the file pointer?
What is the type of 'this' pointer?
Mention the ways in which parameterized can be invoked. Give an example of each.
What is the difference between global variables and local variable
What are static member functions?
What is dev c++ used for?
Explain all the C++ concepts using examples.
Why do we use templates?