fork download
  1. #include <iostream>
  2.  
  3. struct magic_wand
  4. {
  5. magic_wand() { std::cout << "Casting magic spell" << std::endl; }
  6. ~magic_wand() { std::cout << "Uncasting magic spell" << std::endl; }
  7. };
  8.  
  9. int main()
  10. {
  11. std::cout << "[Enter] main" << std::endl;
  12. { magic_wand w; }
  13. std::cout << "[Exit] main" << std::endl;
  14. return 0;
  15. }
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
[Enter] main
Casting magic spell
Uncasting magic spell
[Exit] main