Exception handling in C++

For those of you who were unknown of the fact that exception handling just like python is present in C++ too. Basically it is used if there exists a block of code that may throw an error, so we put that inside a try block which if met with an error won't affect the program compilation but will just throw that error to the catch block and the program will execute successfully. 
This is one of the advantages of C++ over C language. It is just like the "try except exception as" in python, some points to keep in mind are that, implicit type conversion while throwing an error is not applicable to primitive data types( like int ) and when we are throwing an object of a derived class what happens is it gets converted to that of base class and so it is recommended to put the catch block of derived class before that of the base class. 
Well, I couldn't upload a blog yesterday cause I got indulged in DuoLingo, well I remembered about the blog when it was 11:30 in the night so I decided to leave it for today.
Well any port in a storm.
Get Outta Here! 

Comments

Popular Posts