(I never tend to make sure examples are 100% correct, since they are not suppose to be used just to give the very general idea)
It is always better to use existing things, but knowing how they general work is a plus as well. Managing memory is always an issue in C++.
My point is that C++ offers a way to automatically clean memory, unlike C. That mechanism is destructors. And you can simply wrap around a class on existing classes that will handle the dynamical allocation/de-allocation and you won't have to worry about them. Smart pointers can be a result of the above.