在 Qt 5.0 中 - Qt 引入了 QException
类。
继承这个类有什么好处?如果我们抛出一个不继承自 QException 类的类怎么办?
提前致谢!
最佳答案
总之,看完比较短的documentation就能找到答案.
Q: What is benefit of inheriting from this class?
这是文档的对应部分:
The QException class provides a base class for exceptions that can transferred across threads.
除此之外,它还与 QtConcurrent
功能集(包括 QFuture
)很好地集成。
Q: What if we throw a class that does not inherit from the QException class?
这是文档的对应部分:
If you throw an exception that is not a subclass of QException, the Qt functions will throw a QUnhandledException in the receiver thread.
关于c++ - QException 的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23151575/