#include <stdexcept>
#include <string>
using namespace std;
class ListIndexOutOfRangeException : public out_of_range
{
public:
ListIndexOutOfRangeException(const string & message = "") : out_of_range(message.c_str())
{
}
}; // end ListIndexOutOfRangeException
#include <stdexcept> #include <string> using namespace std; class ListIndexOutOfRangeException : public out_of_range { public:
Share
out_of_rangeaccepts a string reference, so just useinstead.
edit:
And as others have said, the compiler is telling you you have used
message.cstr()instead ofmessage.c_str(). But the method call is unnecessary anyway, just pass the string.