Sponsered Links
Categories
Sponsered Links

Try Block of C++ Exception

 

This is a simple Try Block example of C++ Exception. In this example we are going to show how to try block can be localized in a function.

#include <iostream> 

void fun(int test)
  try
    if(testthrow test; 
  
  catch(int i) { 
    cout << "Caught First!  Example #: " << i << '\n'
  

 
int main()
  cout << "start\n"
 
  fun(1)
  fun(2)
  fun(0)
  fun(3)
 
  cout << "end"
 
  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