Insert before *this realocation.

Pages: 123
Jan 13, 2011 at 6:30pm
Just call the methods that do the work from the dtor.
Jan 13, 2011 at 6:48pm
Would there even be a need for a delete function, even if I allocated a new list with new, as long as I have my Remove() and my other function that will iterate through the entire list and remove each node?
Jan 13, 2011 at 7:14pm
If you mean the dtor yes. If the objects arent manually deleted they need
to be deleted by dtor at exit or end of scope. Atleast this is how I understand it.
Jan 13, 2011 at 7:25pm
Yes I understand that, but what code would the destructor function include if I already have defined a remove node function and a "destroy entire list" function?
Jan 13, 2011 at 7:44pm
I would put a call to the "destroy entire list" method in dtor.
Last edited on Jan 13, 2011 at 7:45pm
Jan 13, 2011 at 7:57pm
That's what I was thinking. But the brief I'm working off clearly uses delete and then the "destroy entire list function". My thought is that it was redundant and one could use the same code for the destructor and Remove() function. I just wanted to get your opinions on that...
Last edited on Jan 13, 2011 at 9:17pm
Topic archived. No new replies allowed.
Pages: 123