home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Using Visual C++ 4 (Special Edition)
/
Using_Visual_C_4_Special_Edition_QUE_1996.iso
/
ch13
/
rule7.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-18
|
444b
|
29 lines
// Get needed include files
#include <iostream.h>
#include <eh.h>
void Func1(int flag)
{
try {
cout << "In Func1.\n";
if (flag)
throw "String exception";
}
catch (int) {
cout << "Caught an integer exception.\n";
}
}
void main()
{
try {
Func1(1);
}
catch (char *str) {
cout << "Caught a string exception: " << str << "\n";
}
catch (...) {
cout << "Caught an unrecognized exception.\n";
}
}