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