Multiple Catch Blocks and Catching All Exceptions




This video tutorial explains about the using multiple catch blocks in exception handling in c++ and explains how to catch all exception types in one catch block in c++ programming.
You are going to learn how to place multiple catch blocks, how the statements in the multiple catch blocks will be executed in detail with example.

source code for this tutorial

#include <iostream>
#include <stdexcept>

using namespace std;

int main()
{
    try{

    throw runtime_error("dssds");

    }
    catch(int error){
    cout << error<<endl;
    }

    catch(...){
    cout << "some exception occured"<<endl;
    }


    return 0;
}

 
Back To Top