What is a COPY CONSTRUCTOR and when is it called?



What is a COPY CONSTRUCTOR and when is it called?..

Answer / Ish Bhatia

"A copy constructor is a special constructor in C++ that creates an exact duplicate of an existing object. It's called when you perform any operation like assignment, returning by value from functions or as arguments to functions. The default behavior is a shallow copy, but users can overload the copy constructor for deep copies."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

What are string library functions(syntax).

1 Answers   Accenture,


Explain the operator overloading feature in C++ ?

1 Answers  


What is the difference between virtual functions and pure virtual functions?

2 Answers  


Write a C++ Program to Find Sum and Average of n numbers using for loop.

1 Answers  


Can we call a virtual function from a constructor?

2 Answers  


What is a virtual base class?

6 Answers   Fidelity, Siemens,


Describe the different styles of function prototypes in C++.

1 Answers   Adobe,


What is an abstract class?

6 Answers   Siemens,


Explain function prototypes in C++.

1 Answers   Aricent,


Write a C++ Program to Find whether given Number is Odd or Even.

1 Answers  


What is a constructor initializer list?

1 Answers   Amazon,


How will you execute a stack using a priority queue? (Push and pop should be in O (1)).

1 Answers   Adobe,


Categories