如果一个类继承自另一个类并重写了虚函数,那么派生(重写)函数的异常规范必须如何与基函数相关联?
这是否必须至少具有限制性?正确的?还是其他人?
最佳答案
是的,它必须至少具有同样的限制性(§15.4/3):
If a virtual function has an exception-specification, all declarations, including the definition, of any function that overrides that virtual function in any derived class shall only allow exceptions that are allowed by the exception-specification of the base class virtual function.
关于c++ - 覆盖虚函数时的异常规范?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5295134/