I have a class hierarchy, and each class in it has an exception class, derived in a parallel hierarchy, thus...
class Base
{
};
class Derived : public Base
{
};
You could do this, since you use unnamed enums. I suppose you use integer type to store the reason of the exception.
class DerivedException : public BaseException
{
enum { YET_ANOTHER_REASON = THAT_REASON + 1, EVEN_MORE_REASON};
};
I wouldn't encode reasons as codes. I would prefer specialized exception classes, so I can catch only the exception types that I can handle at one moment.