aboutsummaryrefslogtreecommitdiff
path: root/raii/constructor-hello-world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'raii/constructor-hello-world.cpp')
-rw-r--r--raii/constructor-hello-world.cpp17
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
3class BadType {
4public:
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
14int main() {
15 BadType x;
16 return 0;
17}

Generated with cgit - Back to sebastiano.tronto.net