adsense


Thursday, 26 November 2015

C++ LANGUAGE THROWING EXCEPTION

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE THROWING EXCEPTION






Throwing Exceptions 


Exceptions can be thrown anywhere within a code block 
using throw statement. The operand of the throw 
statement determines a type for the exception and 
can be any expression and the type of the result of 
the expression determines the type of exception thrown.
 
Following is an example of throwing an exception 
when dividing by zero condition occurs: 

double division(int a, int b) 
{ 
   if( b == 0 ) 
   { 
      throw "Division by zero condition!"; 
   } 
   return (a/b); 
} 


No comments: