Throwing Exceptions : Throw « Language « C++
- C++
- Language
- Throw
Throwing Exceptions
#include <iostream>
using namespace std;
void foo()
{
int i;
i = -15;
throw i;
}
int main()
{
try {
foo();
}
catch(int n)
{ cerr << "exception caught\n " << n << endl; }
}
Related examples in the same category