From the answer here I implemented my
NotImplementedException
//exceptions.h
namespace base
{
class NotImplementedException : public std::logic_error
{
public:
virtual char const* what() { return "Function not yet implemented."; }
};
}
std::string to_string() override
{
throw new NotImplementedException();
}
to_string
namespace BSE {
class BaseObject
{
virtual std::string to_string() = 0;
};
}
error C2280: 'BSE::NotImplementedException::NotImplementedException(void)': attempting to reference a deleted function
First, copy-initializes the exception object from expression (this may call the move constructor for rvalue expression, and the copy/move may be subject to copy elision)
NotImplementedException(const NotImplementedException&) = default;
NotImplementedException& operator=(const NotImplementedException&) = default;
error C2512: 'BSE::NotImplementedException': no appropriate default constructor available
std::logic_error
It should be something like:
namespace base
{
class NotImplementedException : public std::logic_error
{
public:
NotImplementedException () : std::logic_error{"Function not yet implemented."} {}
};
}
And then
std::string to_string() override
{
throw NotImplementedException(); // with new.
}