0
[SOLVED] The throw keyword
What is the function of the throw keyword in the try-catch statement? I'm using the Visual Studio, and the try-catch snippet contains the throw keyword like this one below : try { } catch(System.Exception e) { throw; }
3 odpowiedzi
+ 1
The snippet probably uses it to remind you to do something in the catch block. (If you don't, your program blows up)
0
throw keyword is used to bypass the exception in. the code
0
try:
{
cou<<"sololearn"<<endl; // Incorrect
}
catch:
{
error; // Hey it should be "cout" not "cou"
}
throw:
{
cout<<"hi"<<endl; // I catched and displayed the error on the screen and I will continue executing next line of code
}