What is difference between copy constructor and constructor?

Constructor is called when an object is created. Copy constructor is called when the copy of an object is made. For e.g. passing parameter to function by value, function returning by value. Copy constructor takes the parameter as const reference to the object.

No comments: