summaryrefslogtreecommitdiffstats
path: root/sec6.13-throw_try_catch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sec6.13-throw_try_catch.cpp')
-rw-r--r--sec6.13-throw_try_catch.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/sec6.13-throw_try_catch.cpp b/sec6.13-throw_try_catch.cpp
new file mode 100644
index 0000000..bb6d16e
--- /dev/null
+++ b/sec6.13-throw_try_catch.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+
+int main(void)
+{
+ const int x = 0x0;
+
+ try
+ {
+ if (x == 0)
+ throw "throwing a string";
+ }
+
+ catch (const char *str)
+ {
+ std::cerr << str;
+ }
+
+ return 0;
+}