222 +FAQ+ (Intro+Exception+Handling+Construct+)
222 +FAQ+ (Intro+Exception+Handling+Construct+)
name??
you can have multiple catch for same try, another with different data type
can be used
Can you tell me what will happen if we throw a class and try to
display it in the catch() section , like
catch(MyException e)
{
cout << e << endl;
}
don’t display it directly. Call what function
cout<<e->what();
what() should return a string message.
why you have not throw object of class why you have throw
default constructor throwing constructor will create the object and
throw.
For user defines exception class we have to inherit from exception class.
You can inherit it in any way.
It is better to do it using public. Must write public there.
if we have base class named "Vehicle" and derived class "Car" for exceptions.
if an exception of class "Car" is thrown and the catch block is for "Vehicle" then
it will catch the exception of "Car" coz it is also a "Vehicle".