Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
beispiel_fur_exceptionklassen/exception.h
- Committer:
- kafka
- Date:
- 2020-04-21
- Revision:
- 1:18c470c81ce5
File content as of revision 1:18c470c81ce5:
#include <exception> #include <iostream> using std::cout; using std::endl; class myexceptions : public std::exception { public: enum class Error_Type {EVEN, TOO_SMALL}; private: Error_Type error_type_; public: myexceptions(Error_Type error); myexceptions(myexceptions const &var); virtual const char *what() const noexcept; ~myexceptions(); }; myexceptions::myexceptions(Error_Type error) : error_type_ (error) { } myexceptions::~myexceptions() { } const char* myexceptions::what() const noexcept { switch (error_type_) { case Error_Type::EVEN: return "error: number is even"; case Error_Type::TOO_SMALL: return "error: number is too small"; default: return NULL; } }