writing Functions that are gonna Throw Exceptions




This video tutorial explains how to make a function to throw set of exceptions in c++ exception handling.
You are going to learn how to declare functions to specify to the c++ that they are gonna throw exceptions, how to restrict a function from throwing any exception in detail with example.

source code for this tutorial

#include 
#include 

using namespace std;

void test() throw(int,char,runtime_error){

throw runtime_error("what the hack");

}

int main()
{
    try{
    test();
    }catch(int e){
    cout <<" integer type "<< e <
                  
Back To Top