fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. class Ex
  7. {
  8. public:
  9. Ex(){ cout << "ctor\n"; }
  10. Ex(const Ex&){ cout << "cctor\n"; }
  11. ~Ex() { cout << "dtor\n"; }
  12. };
  13.  
  14.  
  15. int main(int argc, char * argv[])
  16. {
  17. for(int i = 0; i < 3; ++i)
  18. {
  19. try
  20. {
  21. throw Ex();
  22. }
  23. catch(Ex&e)
  24. {
  25. }
  26. }
  27.  
  28. }
  29.  
Success #stdin #stdout 0.01s 5444KB
stdin
Standard input is empty
stdout
ctor
dtor
ctor
dtor
ctor
dtor