About memory and delete object in c++

Posted by barssala on Stack Overflow See other posts from Stack Overflow or by barssala
Published on 2012-09-17T09:25:05Z Indexed on 2012/09/17 9:37 UTC
Read the original article Hit count: 132

Filed under:

I will give some examples and explain. First, I declare some object like

CString* param = new CString[100]

And when I declare this one, my memory would increase a little bit because it's some implemented string. Then I store this object in some list of CString just like

List<CString> myList = new List<CString>; // new list of CString

myList.add(param);

This is my question: I wanna know, when I delete myList, my param isn't deleted, right? And memory in param still exists.

Do I misunderstand?

© Stack Overflow or respective owner

Related posts about c++