I am looking at some articles about catch exception by reference.
I don't know what is the difference from this and my usual way as below.
Could you tell me??
Code:try
{
} catch( exception ex)
{
textbox1.text=ex.message;
}
Printable View
I am looking at some articles about catch exception by reference.
I don't know what is the difference from this and my usual way as below.
Could you tell me??
Code:try
{
} catch( exception ex)
{
textbox1.text=ex.message;
}
In normal C++, catching by value involves slicing. Usually code throws exception that are derived from std::exception. If you catch by value, you lose the derived part of the exception object.
Your code however doesn't appear to be standard C++ but I guess the same reasoning may apply.