S
- Steve -
If you want to see all the code it's at http://planetevans.com/c However I
think I have all the relevant parts here.
main() makes the following call
IntArray c = a + b; // IntArray is my class
I have overloaded the + operator like this.
IntArray& IntArray:
perator+(IntArray &addThis)
{
IntArray temp(arrayHigh-arrayLow);
for(int i=temp.low();i<temp.high();++i)
temp=array[arrayLow+i]+addThis.array[addThis.arrayLow+i];
return temp;
}
However it doesn't appear that when the c= part of the line executes that
the temp array is following it. I assume that is becuase temp follows out
of scope and the destructor is called, that does a delete array[]. What
should I do?
think I have all the relevant parts here.
main() makes the following call
IntArray c = a + b; // IntArray is my class
I have overloaded the + operator like this.
IntArray& IntArray:
{
IntArray temp(arrayHigh-arrayLow);
for(int i=temp.low();i<temp.high();++i)
temp=array[arrayLow+i]+addThis.array[addThis.arrayLow+i];
return temp;
}
However it doesn't appear that when the c= part of the line executes that
the temp array is following it. I assume that is becuase temp follows out
of scope and the destructor is called, that does a delete array[]. What
should I do?