KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have been researching, and nothing relevant has come up, so I came here. I am trying to avoid memory leaks, so I am wondering: Say I have class MyClass with member int s a and b , and an int array c , which are filled in a member function: class MyClass { public: int a, b; int c[2]; void setVariables() { a, b = 0; for (int i = 0; i < 2; i++) { c[i] = 3; } } }; int main(int argc, char* argv[]) { MyClass* mc = new MyClass(); mc->setVariables(); delete mc; } Now, after I call delete mc , will a , b , and all the contents of c be deleted as well? Or will I have to do that explicitly in the destructor of MyClass ?
Tags (comma-separated)
Save Edits
Cancel