constructor-hello-world.cpp (229B)
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 }