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
Static Member Functions All the objects of the class share static data members of a class. The example above demonstrates how to keep track of all the objects of a class which

A:  it is containing and hiding Information regarding an object, like internal data structures and code. It isolates the internal complication of an object's operation from the res

Write a program to calculate the total resistance of a series or parallel circuit. The maximum number of resistors is two.   We need to decide whether the user wants the to

#question.develop an algorithm using pseudocode for computing cos(x) and sin(x). use a sentinel controlled while loop. use the series definition of e^+-jx

c program to implement least cost method

Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

A: No. Syntax wise it is permitted. But then the function is no longer Inline. Since the compiler will never know how deep the recursion is at compilation time.

how we use the cin command and why we use this command????

A: Use operator overloading to present a friend left-shift operator, operator #include class Fred { public: friend std::ostream& operator ... private: int i_; // onl

solution of problem based on poiter