KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why doesn't the following doesn't handle the exception that was rethrown? I tried all the combinations but none of them would show the output in last catch so I'm confused! Derived D; try { throw D; } catch ( const Derived &d) { throw; } catch (const Base &b) { cout << "caught!" << endl; } Derived D; try { throw D; } catch ( const Derived d) { throw; } catch (const Base b) { cout << "caught!" << endl; } Derived D; try { throw D; } catch ( const Derived d) { throw; } catch (const Base &b) { cout << "caught!" << endl; } Derived D; try { throw D; } catch ( const Derived &d) { throw; } catch (const Base b) { cout << "caught!" << endl; }
Tags (comma-separated)
Save Edits
Cancel