What will not be called when the terminate() is arised in constructor?
What function will be called when we have a uncaught exception?
What is the output of this program?
1. #include2. using namespace std; 3. #include 4. #include 5. void Funct() 6. { 7. cout << "Funct() was called by terminate()." << endl; 8. exit(0); 9. } 10. int main() 11. { 12. try 13. { 14. set_terminate(Funct); 15. throw "Out of memory!"; 16. } 17. catch(int) 18. { 19. cout << "Integer exception raised." << endl; 20. } 21. return 0; 22. }
What is the output of this program?
1. #include2. using namespace std; 3. class Test1 4. { 5. }; 6. class Test2 : public Test1 { }; 7. void Funct(); 8. int main() 9. { 10. try 11. { 12. Funct(); 13. } 14. catch (const Test1&) 15. { 16. cerr << "Caught a exception" << endl; 17. } 18. return 0; 19. } 20. void Funct() 21. { 22. throw Test2(); 23. }
What is the output of this program?
1. #include2. #include 3. #include 4. using namespace std; 5. void myterminate () 6. { 7. cerr << "terminate handler called"; 8. abort(); 9. } 10. int main (void) 11. { 12. set_terminate (myterminate); 13. throw 0; 14. return 0; 15. }