Created
February 5, 2017 19:58
-
-
Save a-square/8637b5d1459d1ef95f60a35cbbfcfd15 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> | |
class Foo { | |
public: | |
explicit Foo(int) { | |
throw "Wow!"; | |
} | |
}; | |
class Bar { | |
public: | |
Bar() try : foo(4) { | |
std::cout << "Much exceptions" << std::endl; | |
} catch(...) { | |
std::cout << "Such semantics" << std::endl; | |
} | |
private: | |
Foo foo; | |
}; | |
int main() { | |
try { | |
Bar bar; | |
} catch(...) { | |
std::cout << "So C++" << std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment