If I am using a CString like this:
void myFunc(char *str)
{
CString s(str);
// Manipulate other data with CString
// ...
// Finished
// Should I somehow delete 's' here to avoid a memory leak?
}
Is the string erased once the function goes out of scope?
Also, I know that the new
keyword allocates memory, if I construct an object without the new
keyword, is memory still allocated? My intuition tells me yes, but I would like to verify.
e.g.
CString *asdf = new CString("ASDF");
// same as?
CString asdf("ASDF");