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
Aim: To implement a program to maintain information of employees in an educational institute using inheritance. Code:                       class staff {

write a C code that plots an object on the window and on the user''s click of mouse on the window, the object starts rotating continuously until the user presses the mouse again

Input Format: First line starts with T, which is the number of test cases. Each test case contains a string (S). Output Format: For each test case print the minimum number of ch

Describe the “placement new" and why would I use it?

what is the diffeerence between c and c++

Give practice in writing program''s..

Explain protected, public, private in C++? These are three access spaecifiers in C++. - Public - Here data members and functions are accessible outside the class. - Pr

THIS PROGRAM IS TO DISPLAY A STOCK CONTAINING ITEM CODE,ITEM NAME,PRICE AND ANOTHER STOCK WITH CODE & QUANTITY AND DISPLAY COMPLETE INFORMATION #include #include #include

- Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulati

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci