C++ why you need to have a good copy constructor

shallow copy vs deep copy

Do you see any problem?

If you just compile and run, you will not notice a big problem here.

However, if you compile with address sanitizer with an option of -fsanitize=address then you will see a big problem of double free !!!