The principles of exception handling require that an exception handler must do only one of the following:
Sketch examples in C++ syntax.
class Node {
Table *table; Name *name; public: Node(const char *n) : table(new Table()), name(new Name(n)) {} // ... }; |
Rewrite this using auto_ptrs to avoid the need for a destructor. Does this mean you don’t need a copy constructor or an assignment operator? (You’ll need to read the auto_ptr class to answer this.)
You can include the auto_ptr class by saying
#include <memory>
|