What is copy constructor?- Copy constructor allows creating new objects from existing objects by initialization. - Example : First argument of is a reference to an object of the same type as is being constructed (const or non-const), which might be followed by parameters of any type (all having default values). X(X& copyFromMe);What is copy constructor?A copy constructor is a special type of constructor that is used to create an object as a copy of an existing object. It takes an argument which is a reference to the object to be copied.
|