Code:
Read the following code and answer the question bellow: void main(void)
{
CMyStr* pStr = new CMyStr();
CMyStr* pStr2 = NULL;
*pStr = "aba";
CMyStr** ppStr = pStr;
Print(*ppStr);
CMyStr sName("Walla");
CMyStr sPosition;
sPosition = "1";
CMyStr sFull = sName + sPosition;
sFull += "2";
Print(sFull);
if(sFull.Length())
Print(sFull[0]);
*pStr += sFull;
Print(*pStr);
}
Assume:
Print(char* msg) method gets a string pointer and prints it into the screen in a new line.
Questions:
a. Write the CMyStr class that was used here.
b. What does the program output will be?
c. Can you think of problems in the code? If you do, please fix.
