fork(3) download
  1. #include <stdexcept>
  2. #include <iostream>
  3.  
  4. struct myStackException : public std::exception
  5. {
  6. const char *what() const noexcept { return "Stack Overflow"; }
  7. };
  8.  
  9. void foo()
  10. {
  11. throw myStackException();
  12. }
  13.  
  14. int main()
  15. {
  16. try
  17. {
  18. foo();
  19. }
  20. catch (const myStackException& e)
  21. {
  22. std::cout << e.what();
  23. }
  24. }
  25.  
  26.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
Stack Overflow