Where to define exception classes, inside classes or on a higher level?
Posted
by
rve
on Stack Overflow
See other posts from Stack Overflow
or by rve
Published on 2010-12-24T21:13:18Z
Indexed on
2010/12/26
6:54 UTC
Read the original article
Hit count: 172
Should exception classes be part of the class which may throw them or should they exist on a higher level?
For example :
class Test
{
public:
class FooException: public ExceptionBase { };
void functionThrowingFooException();
};
or
class FooException: public ExceptionBase { };
class Test
{
public:
void functionThrowingFooException();
};
(functionThrowingFooException()
is the only function to ever throw a FooException
)
© Stack Overflow or respective owner