I'm currently building a C++ game engine as a learning exercise, and am incorporating exceptions into the less performance-critical sections. I'm primarily a PHP and Ruby developer, so I'm used to declaring new classes of exception on a regular basis using simple syntax like this:
class SomeSubSystemException < Exception; end
or
class SomeSubSystemException extends Exception {};
is there an easy syntax for doing this in C++, or am I going about exception handling the wrong way for C++ projects? Currently I have to do the following for every class of exception, which makes me want to not define very many:
class SubSystemException : public MainException {
SubSystemException(std::string& msg) : MainException(msg) {}
};
Thanks in advance!
std::exception
.