// Run this through valgrind to see the horribleness class BadCopy { public: BadCopy() { arr_ = new int[5]; } /* * Default copy constructor: * equivalent to * this->arr_ = rhs.arr_ * * This is bad! Especially * with how we're using it below! */ ~BadCopy() { delete [] arr_; } private: int *arr_; }; int main(int argc, char** argv) { BadCopy * bc1 = new BadCopy; BadCopy * bc2 = new BadCopy(*bc1); delete bc1; // bc2 now holds a dangling pointer delete bc2; return 0; }