Sponsered Links
Categories
Sponsered Links

C++ Catch all exceptions

 

This example show how to handle multiple throw in one catch statement.

#include <iostream> 

void fun(int test)
  try
    if(test==0throw test;
    if(test==1throw 'a';
    if(test==2throw 123.23;
  
  catch(...) {
    cout << "Caught One!\n"
  

 
int main()
  fun(0)
  fun(1)
  fun(2)
 
  return 0
}


 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved