int getElement(int rows) {
int i = 5;
if (rows > MAXROWS) {
throw 5;
}
return table[rows];
}
enum Excepts
{
OutOfRangeException
};
int getElement(int rows)
{
Excepts i = OutOfRangeException;
if (rows > MAXROWS)
{
throw i;
}
return table[rows];
}
void afunc(int e) throw(int)
{
if (e > 5)
{
throw -1;
}
}
int i = 9;
try {
afunc(i);
} catch (int e) {
if (e == -1) {
cout << "We encountered the exception for an invalid value!"
<< endl;
return;
}
} catch (...) {
cout << "An unknown exception was found!!" << endl;
throw;
}