Catch more than one type of exceptions
#include <iostream> using namespace std; void XHandler(int test){ try { if(test==0) throw test; if(test==1) throw 'a'; if(test==2) throw 123.23; }catch(int i){ cout << "Caught an integer." << endl; }catch(...){ cout << "Caught one." << endl; } } int main(void){ cout << "Start: " << endl; XHandler(0); XHandler(1); XHandler(2); cout << "End"; }