Here is the code of copy assignment and move assignment for Vector class:

```
//Copy assignment

Vector& Vector::operator = (const Vector& other)
        {
            double* p = new double[other.size];
            copy(other.elem,other.elem + other.size,elem);
            delete[] elem;
            elem = p;
            size = other.size;
            return *this
        }

```

Here is how I understood Copy assignment:

```
double* p = new double[other.size]; 

```

- means, that we allocate new space for our new vector

```
copy(other.elem,other.elem + other.size,elem);

```

- we copy all elements of `other` vector(from first element `other.elem` to the last element `other.elem + other.size`) to the space p?

```
delete[] elem;

```

-we deallocate old space, because we will substitute it by new one

```
elem = p;
size = other.size;
return *this

```

- We substitute parameters by new parameters and return them

is my understanding correct?

What I don't understand(or at least for now my brain cannot accept it), that if we deallocate old space, why is it possible to allocate new elements to it?