Suppose I have a class. It has some members and some variables and
all that. The methods are not important in this question.
class IntSet
{
public:
...
private:
int threshold;
int[] set;
}
Suppose I have a destructor and I want to make sure that all of the
resources previously owned by this class will be given back to the
system when an instance of the class is deleted. Should the
destructor be:
IntSet::~IntSet()
{
delete[] set;
delete threshold;
}
Or should it be:
IntSet::~IntSet()
{
delete[] set;
}
Or are both variants wrong?
Thanks in advance for the help.