fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A{
  5. private: int i;
  6.  
  7. public:
  8.  
  9. A()
  10. {
  11. i = 10;
  12.  
  13. }
  14. ~A()
  15. {
  16. throw 30;
  17. }
  18. };
  19. int main(){
  20. try{
  21. A();
  22. throw 10;
  23. }
  24. catch(int i){
  25. cout<<i<<endl;
  26. cout<<"exception caught"<<endl;
  27. }
  28. }
Runtime error #stdin #stdout #stderr 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'int'