Subscribe Us

Responsive Advertisement

Advertisement

Exception Handling Restricting Exception in cpp

 





#include<bits/stdc++.h>

using namespace std;

void fan(int a) throw(int)//only throw integer

{

   if(a==1) throw 1;

    throw 4.5;

}

int main()

{


  try

  {

      fan(1);


  }

  catch(...)

  {

      cout<<"Error\n";


  }



    return 0;

}


Post a Comment

0 Comments