类 C++ 错误:"Virtual is not allowed"
Class C++ Error : "Virtual is not allowed"
我有一个我正在做的项目的标题:
#include<iostream>
#include<exception>
using namespace std;
class InvalidException : public exception
{
private:
string message;
public:
InvalidException(const char *message)
{
this->message = message;
}
virtual const char *catch_the_error const throw()
{
return this->message.c_str();
}
};
说明在这里不允许虚拟,我不知道为什么,因为我的例外是公开的。有人可以给我一个答案吗?
更改
virtual const char *catch_the_error const throw()
to
virtual const char *catch_the_error() const throw()
相关文章:
- Directx 11 - CompileFromFile() is not compiling
- Centos7 g++ "to_string is not in a member of std"
- 将成员函数作为构造函数参数调用时出错 "Variable is not a type name"
- reference_wrapper导致"incomplete type is not allowed"
- 结构中的错误"Incomplete type is not allowed"
- "Called Object Type is Not a Function or Pointer" 与 typedef 和类
- 无法创建 DLL:获取 DLL "is not a valid Win32 application"
- Atom gpp编译器给出"'C:UsersadminUser' is not recognized as an internal or..."错误
- 当我编译XG-Bosst时,出现错误"error: 'Split' is not a member of 'xgboost::common' ……"
- C++ DLL 运行时错误"abc.dll is not a valid WIN32 application" 。请帮助解决这个问题
- 如何修复 eigen3 中的'non-type template argument is not a constant expression'?
- 我的代码应该接受一个数字,并返回字母等级或"Grade is not valid"但 else 语句不起作用
- 如何修复此错误"the value of 'x1' is not usable in a constant expression"?static_assert
- 加载安全区图像"A device attached to the system is not functioning"
- 巴泽尔中的错误"name 'new_local_repository' is not defined"
- 如何修复 SDL2 "GLSL 3.30 is not supported"错误
- 函数模板(它是类模板的成员)的显式专用化会产生"partial specialization is not allowed"错误,为什么?
- 为什么"an inherited constructor is not a candidate for initialization from an expression of the same or
- CGAL 绘制函数在 Visual Studio 中给出'CGAL_USE_BASIC_VIEWER is not defined'错误
- "OpenCV Error: The function/feature is not implemented"安卓应用程序