Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Exception
- {
- public:
- // construction
- Exception(int code, const char* format="", ...);
- virtual ~Exception(void);
- <snip - get/set routines and print function>
- protected:
- private:
- int mCode; // thrower sets this
- char mMessage[Exception::MessageLen]; // thrower says this FIXME: use String
- };
- class Derived : public Exception {
- public:
- Derived (const char* throwerSays) : Exception(1, throwerSays) {};
- };
- void innercall {
- <do stuff>
- throw Derived("Bad things happened!");
- }
- void outercall {
- try {
- innercall();
- }
- catch(Exception& e)
- {
- printf("Exception seen here! %s %dn", __FILE__, __LINE__);
- throw e;
- }
- }
- catch(Exception& e)
- {
- printf("Exception seen here! %s %dn", __FILE__, __LINE__);
- throw;
- }
- throw e;
- throw;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement