home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / stdexcpt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-16  |  1.6 KB  |  47 lines

  1. /********************************************************************/
  2. /*  <stdexcpt.h> header file                                        */
  3. /*                                                                  */
  4. /*  VisualAge for C++ for Windows, Version 3.5                      */
  5. /*    Licensed Material - Property of IBM                           */
  6. /*                                                                  */
  7. /*  5801-ARR and Other Materials                                    */
  8. /*                                                                  */
  9. /*  (c) Copyright IBM Corp 1991, 1996. All rights reserved.         */
  10. /*                                                                  */
  11. /********************************************************************/
  12.  
  13. #ifndef __STDEXCEPT_H
  14. #define __STDEXCEPT_H
  15.  
  16. class exception {
  17. public:
  18.   exception(const char* exceptionName) : desc(exceptionName), alloced(0) { }
  19.   virtual ~exception();
  20.   virtual const char* what() const { return desc; }
  21. protected:
  22.   exception() : desc(0), alloced(0) { }
  23. private:
  24.   const char* desc;
  25.   unsigned int alloced;
  26. };
  27.  
  28. class logic_error : public exception {
  29. public:
  30.   logic_error(const char* exceptionName) : exception(exceptionName) { }
  31.   virtual ~logic_error();
  32. };
  33.  
  34. class bad_cast : public logic_error {
  35. public:
  36.   bad_cast(const char* = 0) : logic_error ("bad_cast") { }
  37.   virtual ~bad_cast();
  38. };
  39.  
  40. class bad_typeid: public logic_error {
  41. public:
  42.   bad_typeid(const char* = 0) : logic_error ("bad_typeid") { }
  43.   virtual ~bad_typeid();
  44. };
  45.  
  46. #endif /* __STDEXCEPT_H */
  47.