The language itself defines two operators that allocate and free dynamic memory. The
new operator allocates memory, and
delete frees memory allocated by
For reasons that will become clear as we describe how these operators work, using these operators to manage memory is considerably more error-prone than using a smart pointer. Moreover, classes that do manage their own memory—unlike those that use smart pointers—cannot rely on the default definitions for the members that copy, assign, and destroy class objects (§ 7.1.4, p. 264). As a result, programs that use smart pointers are likely to be easier to write and debug.
Until you have read Chapter 13, your classes should allocate dynamic memory only ...