Name

exception class — Base class for all standard exceptions

Synopsis

class exception {
public:
  exception(  ) throw(  );
  exception(const exception&) throw(  );
  exception& operator=(const exception&) throw(  );
  virtual ~exception(  ) throw(  );
  virtual const char* what(  ) const throw(  );
};

The exception class is the base class for all exception objects thrown by the standard library or by code generated by the compiler. By convention, user-defined exception classes also derive from exception or from one of its derived classes.

virtual const char* what ( ) const throw( );

Returns a message that describes the nature of the exception. The exact contents of the string are implementation-defined; it might be a multibyte string, which can be converted to a wstring.

See Also

bad_exception class, bad_alloc in <new> , bad_cast in <typeinfo> , bad_typeid in <typeinfo> , ios_base::failure in <ios> , logic_error in <stdexcept> , runtime_error in <stdexcept>

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.