فهرست منبع

0921 修改自定义异常类

caizm 2 سال پیش
والد
کامیت
d19f7cb1c7
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      CAE_Solution/src/threadPool_and_statemachine/dealWith/display_struct.h

+ 3 - 2
CAE_Solution/src/threadPool_and_statemachine/dealWith/display_struct.h

@@ -230,10 +230,11 @@ public:
 };
 
 //异常类
-class myException :public exception   //自己的异常类继承标准库中的异常类
+class myException :public logic_error   //自己的异常类继承标准库中的异常类
 {
 public:                               //父类中为char*类型,把string转换为char*
-    myException(string str) :exception(str.c_str()) {}
+    myException(const string &str) :logic_error(str) {}
+    virtual ~myException() throw(){}
 };
 
 #endif // DISPLAY_STRUCT_H