home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Using Visual C++ 4 (Special Edition)
/
Using_Visual_C_4_Special_Edition_QUE_1996.iso
/
ch13
/
rules145.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-18
|
507b
|
33 lines
// Get needed include files
#include <iostream.h>
#include <eh.h>
class First1 { };
class First2 { };
class Last : public First1, public First2 { };
Last MyLast;
void Func1(int flag)
{
cout << "In Func1.\n";
if (flag)
throw MyLast;
}
void main()
{
try {
Func1(1);
}
catch (First1&) {
cout << "Caught a First1 exception.\n";
}
catch (First2&) {
cout << "Caught a First2 exception.\n";
}
catch (...) {
cout << "Caught an unrecognized exception.\n";
}
}