What is copy constructor?, C/C++ Programming

What is copy constructor?

 

 

Posted Date: 3/15/2013 4:01:37 AM | Location : United States





A: Constructor that initializes the it''s object member variables (by shallow copying) with another object of the same class. If in your class you don''t implement one then compiler implements one for you. For instance:

1.      Boo Obj1(10); // calling Boo constructor

2.      Boo Obj2(Obj1); // calling boo copy constructor

3.      Boo Obj2 = Obj1;// calling boo copy constructor

Posted by | Posted Date: 3/15/2013 4:01:51 AM


Related Discussions:- What is copy constructor?, Assignment Help, Ask Question on What is copy constructor?, Get Answer, Expert's Help, What is copy constructor? Discussions

Write discussion on What is copy constructor?
Your posts are moderated
Related Questions


program for lexicographically precedes the given input permutation

Program is to read the characters from keyboard: Program is to read the characters from keyboard one by one stored in different files as upper constants, lower constants, othe

Q. Explain that how do we implement two stacks in one array A[1..n] in such a way that neither the stack overflows unless the total number of elements in both stacks together is n.

How can one make it so keys pressed through users are not echoed on the screen? A: It is not a standard C++ feature. C++ doesn't even need your system to have a keyboard or a sc

Q: Name the operators which cannot be overloaded? A:sizeof, ., .*, .->, ::, ?:

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Write a program which incorporates a function named compute and which is used to calculate the area and circumference of a circle. Use the main function for inputs and outputs.