Answers to Quiz 5

  1. 錯誤發生在 strcpy_s(m_Contents, strlen(m_contents), str);中
    strlen(m_Contents)會去搜尋 m_Contents中到'\0'的長度.
    因為m_Contents是一個point,如果超過m_Contents所宣告的長度,程式會發生錯誤.
    改成 strcpy_s(m_Contents, strlen(str)+1, str)就可以了
  2. CBox constructor called
    CCandyBox constructor called
    CBox constructor called
    CCandyBox constructor called
    CCandyBox destructor called
    CBox destructor called
    CCandyBox destructor called
    CBox destructor called