What is 'Copy Constructor' and when it is called?

Answer Posted / hrpynux@gmail.com

A copy constructor is called when an object is passed by value. Copy constructor itself is a function. So if we pass an argument by value in a copy constructor, a call to copy constructor would be made to call copy constructor which becomes a non-terminating chain of calls.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you add an element to a set in c++?

749


What is the use of "new" operator?

888


Define the process of error-handling in case of constructor failure?

788


What are references in c++?

885


What is the default access level?

824


What is a down cast?

850


How do you generate a random number in c++?

830


What do you mean by global variables?

840


What is class definition in c++ ?

822


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

810


What is pure virtual function? Or what is abstract class?

812


What is a constructor in c++ with example?

815


What is object in c++ wikipedia?

759


Can we use this pointer in a class specific, operator-overloading function for new operator?

840


Will c++ be replaced?

819