Created
December 1, 2012 17:48
-
-
Save ElemarJR/4183542 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| void willThrowException(){ | |
| throw 42; | |
| } | |
| void willRethrow() { | |
| try { | |
| willThrowException(); | |
| } catch (int e) { | |
| cout << "catched: " << e << endl; | |
| throw; | |
| } | |
| cout << "Never executed!"; | |
| } | |
| int main() { | |
| try { | |
| willRethrow(); | |
| } catch (int e) | |
| { | |
| cout << "catched (main): " << e << endl; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment