fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. struct Foo
  6. {
  7. Foo() { cout << "Konstruktorbeginn"; throw exception(); cout << "Konstruktorende"; }
  8. ~Foo() { cout << "Destruktor"; }
  9. };
  10.  
  11. int main()
  12. {
  13. try
  14. {
  15. Foo foo;
  16. }
  17. catch(...) { cout << "gefangen"; }
  18. cout << "Ende";
  19. }
Success #stdin #stdout 0.01s 2812KB
stdin
Standard input is empty
stdout
KonstruktorbeginngefangenEnde