About memory and delete object in c++
- by barssala
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?