struct A
{
short foo[1000];
short fooo;
bool ifDynamic;
A(int i)
{
if (i>1000)
{
foo=newshort [i];
ifDynamic=1;
}
else ifDynamic=0;
fooo=20;
}
~A()
{
if(ifDynamic) delete [] foo;
}
}
And then I call the structure by A(3000), later destroy A with A.~A. I know the memory dynamically allocated to foo will be freed, but how about the original short[1000] allocated to foo? Will that be destroyed too? If not, how to destroy them? I don't want to create junk in my memory every time I call this structure...