-2
我有这个头一个项目我做:类C++错误:“虚拟不允许”
#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();
}
};
而且它说,虚拟这里不允许使用,我不知道为什么,因为我例外被公开。有人可以请给我一个答案吗?
你忘了添加函数参数'()'符,刚过'虚拟为const char * catch_the_error',之前你的'const'和'抛()'说明符, – WhiZTiM