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
What is virtual base class uses?
Define a nested class.
What flag means?
What are the two types of comments, and how do they differ?
Why ctype h is used in c++?
What is data hiding c++?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
What do you mean by translation unit in c++?
Can constructor be private in c++?
How does atoi function work?
What is the difference between a reference and a pointer?
Explain storage qualifiers in c++.
What is general form of pure virtual function? Explain?
Describe new operator?
What do you mean by a template?