KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My question is simple, but I haven't been able to find the question anywhere. If I have a class like such class A { vector<int> data; } When an instance of A gets destroyed will data also get destroyed properly, or should I write a destructor for A that calls data 's destructor? Basically I worried about whether the dynamic memory of vector will not be freed when an instance of A is destroyed. I suspect the answer is that data is freed properly, but I don't want to find out I'm wrong the hard way. Further, if A was a struct would the destructor for data get called when a local instance of A falls out of scope?
Tags (comma-separated)
Save Edits
Cancel