Tuesday, 25 June 2013

what is exception handling in c++

we often come across some peculiar problems other than logic or syntax errors. They are known as exceptions.
Exceptions are run time error  or usaul conditions that a program may encounter while executing; Exception comes in the the condition when we divide by ZERO, this also comes in picture during the run time

how we use the Exception handling mechanism

try
{           .......................
            throw  Exception;   // block of statements which
                                           // detects and throws an exceptions
}
catch(type  org)
{
                 ..........................................................
                 ............................................................
                
               Block of statement that handles exceptions 
}

when the try block throws an exception , the program control leaves the try block and enters the catch statement of the catch block .
we must  keep in mind that exceptions are an object , used to transmit information  about the problem .




0 comments:

Post a Comment