diff options
Diffstat (limited to '')
| -rw-r--r-- | raii/constructor-hello-world.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/raii/constructor-hello-world.cpp b/raii/constructor-hello-world.cpp new file mode 100644 index 0000000..c86e1ca --- /dev/null +++ b/raii/constructor-hello-world.cpp | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #include <iostream> | ||
| 2 | |||
| 3 | class BadType { | ||
| 4 | public: | ||
| 5 | BadType() { | ||
| 6 | std::cout << "Variable created!" << std::endl; | ||
| 7 | } | ||
| 8 | |||
| 9 | ~BadType() { | ||
| 10 | std::cout << "Variable destroyed, bye bye" << std::endl; | ||
| 11 | } | ||
| 12 | }; | ||
| 13 | |||
| 14 | int main() { | ||
| 15 | BadType x; | ||
| 16 | return 0; | ||
| 17 | } | ||
