ソースを参照

0921 修改自定义异常类

caizm 2 年 前
コミット
d19f7cb1c7

+ 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