deleting dynamically allocated object that contains vector in C++ STL
- by kobac
I have a class
class ChartLine{
protected:
vector<Point> line; // points connecting the line
CString name; //line name for legend
CPen pen; //color, size and style properties of the line
};
where Point is a structure
struct Point{
CString x;
double y;
};
In main() I dynamically allocate objects of type ChartLine with new operator.
If I use delete afterwards, will default destructor ~ChartLine() properly dealocate (or clear) member ChartLine::line(which is vector btw) or I would have to clear that vector in ~ChartLine() manually?
Thanks in advance.
Cheers.