KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
It just happened to me I wondered how resources are freed in the following case. class Base { Resource *r; public: Base() { /* ... */ } ~Base() { delete r; } }; class Derived : public Base { public: Derived() { /* ... */ } ~Derived() { /* Suddenly something here throws! */ } }; int main() { try { Derived d; } catch(...) { /* what happened with Base::r !? */ } } Will the base class destructor be called if the derived class destructor throws? Or will there be a leak?
Tags (comma-separated)
Save Edits
Cancel