This is the method used to handle addition of MyString class objects. Everything runs fine until the delete [] buff - statement. using visual studio community
MyString MyString::operator + (const MyString &rhs) const {
size_t buff_size{ std::strlen(this->str) + 1 };
char *buff = new char[buff_size];
strcpy_s(buff, buff_size, str);
size_t noOfEls{ std::strlen(str) + std::strlen(rhs.str) + 1 }; // total length + null terminator
strcat_s(buff, noOfEls, rhs.str);
MyString temp{ buff };
delete[] buff; // complier error here
return temp;
}