Homework/HW01/MyArray.cc
MyArray::MyArray(MyArray &data)
    : size(data.size) // initialize the size
{
    // allocate the array
    array = new int[size];

    // copy all the values from data
    for (int i=0; i<size; i++)
        array[i] = data.array[i];
}
// Copy constructor: initializes the target object with the size of
// the object data and copies the content of the object data into the
// target object.
Copy constructor: initializes the target object with the size of
the object data and copies the content of the object data into the
target object.
Copy constructor : initializes the target object with the size of the object data and copies the content of the object data into the target object .
MyArray::MyArray(MyArray &data)
    : size(data.size) 
{
    array = new int[size];
    for (int i=0; i<size; i++)
        array[i] = data.array[i];
}
MyArray :: MyArray ( MyArray & data ) : size ( data . size ) { array = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) array [ i ] = data . array [ i ] ; }
Copy constructor: initializes the target object with the size of
the object data and copies the content of the object data into the
target object.
Copy constructor : initializes the target object with the size of the object data and copies the content of the object data into the target object .
// initialize the size // allocate the array // copy all the values from data