See Shallow vs Deep Copies and Effective C++
Point
does not need deep copy. As a thumb rule, "deep copy" is required when a class has pointer members. The Point
class have only two int
members, so it does not require any special effort for "deep copy", the normal or "shallow copy" would do perfectly fine. In fact, it is not required to write a copy-constructor for Point
, the default or synthesized one provided by the compiler would do just fine.
Regarding your second question, after the line
vector< Point > otherArr = myArr;
is executed, otherArr
and myArr
are two independent vectors. Operations (e.g. delete some elements) performed on one of them does not affect the other in any way.