- How to define a run-time exception in c ?
- class my_exception : public std::exception
- {
- public:
- my_exception(const std::string& msg) : msg_(msg) {}
- const char* what(); // override what to return msg_;
- private:
- std::string msg_;
- };
- //some other code..
- throw my_exception("Error");