I have a dynamic array (For this example, SIZE = 2):
polyTerm** polyn = new polyTerm* [SIZE];
I then add a few new ponlyTerm object to the array:
polyn[0] = new polyTerm(5.0,1);
polyn[1] = new polyTerm(2.0,1);
Now I want to remove the object from slot 0 and make the pointer null. How would I go about doing this? I currently have:
delete &polyn[0];
Then I use:
polyn[0] = NULL;
To make the pointer null.
Will this work?
EDIT:
Correction, I need to use delete polyn[0] - even so, setting that to NULL should affect the pointer, as it would still technically point to the original location of the object. Resetting it to NULL removes any errors that could pop up later.
delete[]it will call the destructors ofpolyTerm