Wednesday, January 22, 2014

CODE SNIPPET: Exception Class in C++

Here is a code snippet on how to create an exception class in C++

#include <exception>

class E : public exception {
const char * msg;
E(){};
public:
E(const char * s) throw() : msg(s) {}
const char * what() const throw() { return msg; }

};

Search This Blog