You should probably get from std :: runtime_error or one of the other standard exceptions (see <stdexcept>), and not directly from std :: exception. It defines the what () method correctly in addition to describing what exactly is happening.
It is also usually best to define a different exception for each problem, rather than using an enumeration. This allows the try catch mechanism to catch the corresponding problems, but it all depends on your specific situation and without additional information that is difficult to understand.
class myException: public std::runtime_error { public: myException(std::string const& msg): std::runtime_error(msg) {} };
But:
so based on type, member functions are available.Calling member function that is not available should throw an exception.
It smells funny (Like the smell of Martin Fowler (see his book).
source share