home *** CD-ROM | disk | FTP | other *** search
- // Get needed include files
- #include <iostream.h>
- #include <eh.h>
-
- class LocalGuy
- {
- public:
- LocalGuy() { cout << "In the LocalGuy constructor.\n"; }
- ~LocalGuy() { cout << "In the LocalGuy destructor.\n"; }
- };
-
- class Base
- {
- public:
- Base() { cout << "In the Base constructor.\n"; }
- ~Base() { cout << "In the Base destructor.\n"; }
- };
-
- class Derived: public Base
- {
- public:
- Derived(int flag)
- {
- LocalGuy MyLocalGuy;
- cout << "In the Derived constructor.\n";
- if (flag)
- throw -1;
- }
- ~Derived() { cout << "In the Derived destructor.\n"; }
- };
-
- void main()
- {
- try {
- Derived(1);
- }
- catch (int) {
- cout << "Caught the Derived class exception.\n";
- }
- }
-