Assume I have a structure with two pointers each pointing to an object that has an implemented destructor. Also assume that the head points to a Listnode structure that has a non-NULL value *student and *next:
struct Listnode {
Student *student;
Listnode *next;
};
Listnode *head = new Listnode;
If I use the delete
reserve word on the Listnode pointer 'head' will it call the destructors within that structures Student class and Listnode class which 'student' and 'next' point-to respectively. In other words, will deleting *head also delete *student and *next provided head was the only pointer to that Listnode