Question - How to Copy constructor ?
Answer -
A copy constructor is used to create an instanc... A copy constructor is used to create an instance from another instance, e.g.:
MyClass A;
MyClass B (A);
When B is instantiated, the following constructor is called:
B (B const & object);
Use the body of the copy constructor to copy member data from the source object. e.g.:
class Ints
{
int x, y;
Ints (Ints const & object)
{
x = object.x;
y = object.y;
}
};