MattWoberts
Programmer
Hi,
I think this is a simple question - I just can't find any reesources to help me.
I have an array called i, in my class. I need to de-allocate using delete, but only if it has been allocated in the first place (it may not be allocated in the classes life).
My class destructor is pretty simple:
CInterval::~CInterval()
{
delete [] i;
}
I thought this would work:
CInterval::~CInterval()
{
if )i != null)
delete [] i;
}
But, it doesn't!
Any ideas?
I think this is a simple question - I just can't find any reesources to help me.
I have an array called i, in my class. I need to de-allocate using delete, but only if it has been allocated in the first place (it may not be allocated in the classes life).
My class destructor is pretty simple:
CInterval::~CInterval()
{
delete [] i;
}
I thought this would work:
CInterval::~CInterval()
{
if )i != null)
delete [] i;
}
But, it doesn't!
Any ideas?