A
Alexander Lurye
Hi!
I have the following problem:
Suppose that we have the following class:
class A;
class AException {
public:
enum ERROR { INTERNAL, USAGE, GENERAL };
AException(ERROR e):error(e) {}
inline ERROR GetError() const { return error; }
private:
ERROR error;
};
A throws AException in case of some error.
Now I need to write another class
class B: public A;
That have all types of errors A have, and also one more type (e.g.
PARSE).
I have two solutions for the problem, but I don't like them.
First is to define BException with it's own enum, and to perform catch
for all AException inside B, then throwing BException.
Second is to define error as int, and use #define.
Thanks in advance,
Alexander Lurye
I have the following problem:
Suppose that we have the following class:
class A;
class AException {
public:
enum ERROR { INTERNAL, USAGE, GENERAL };
AException(ERROR e):error(e) {}
inline ERROR GetError() const { return error; }
private:
ERROR error;
};
A throws AException in case of some error.
Now I need to write another class
class B: public A;
That have all types of errors A have, and also one more type (e.g.
PARSE).
I have two solutions for the problem, but I don't like them.
First is to define BException with it's own enum, and to perform catch
for all AException inside B, then throwing BException.
Second is to define error as int, and use #define.
Thanks in advance,
Alexander Lurye