When I create a class, include a pointer in it, and create an object in automatic storage, should I include a destructor in the class? (is it necessary to free the space in the memory?) Example:
class Node{
char *Name;
int age;
Node(char *n = 0, int a = 0) {
name = strdup(n);
age = a;
}
~Node(){
if (name != 0)
delete(name);
}
}
Node node1("Roger",20);