All objects thrown by components of the standard library are derived from this class. Therefore, all standard exceptions can be caught by catching this type.
It is declared as:
Some classes derived from exception are: bad_alloc, bad_cast, bad_exception, bad_typeid, logic_error, runtime_error, ios_base::failure...
- default constructor: exception () throw();
- Constructs an object.
- copy constructor: exception (const exception&) throw();
and assignment: exception& operator= (const exception&) throw();
- Copies an exception object (the results of calling member what on the copy are implementation-specific).
- destructor: virtual ~exception() throw();
- Destroys the object.
- const char* what() const throw();
- Returns a null terminated character sequence containing a generic description of the exception.
Both the wording of such description and the character width are implementation-defined.
exception caught: St10bad_typeid