sichtbar machen

Dependencies:   mbed

Revision:
1:18c470c81ce5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/beispiel_fur_exceptionklassen/exception.h	Tue Apr 21 18:37:00 2020 +0000
@@ -0,0 +1,40 @@
+#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;
+  }
+  
+}
\ No newline at end of file