, , ++. , , . - ( ), . , .
, , ( ) .
class A
{
public:
void f()
{
int x;
int a = 0;
if(a == 0)
throw std::runtime_error( "Divide by zero Exception");
x=1/a;
}
A()
{
try
{
f();
}
catch(const std::runtime_error& e)
{
cout << "Exception caught\n";
cout << e.what();
}
}
};