Problem: I am not able to pass two parameters, concatenate them in dynamically allocated memory, delete the memory and return the concatenated value. It seems like this should be straight forward, but I am running into all types of issues.
Code:
Code:
TestString TestString::concat(const TestString &value) const
{
//Length
char *str = new char[(strlen(str) + strlen(value.str) + 1)];
//strcat
strcat(str, value.str);
//delete ??
//somehow i need to delete before I return the value;
delete [] str;
//This most likely to early since I haven't returned anything yet
//return
return str;
}