|
Boost : |
From: Dave Gomboc (dave_at_[hidden])
Date: 2003-08-24 19:17:13
> Maybe I am not seeing this from the right perspetive, but wouldn't a
better
> design guideline be not to use multiple inheritance at all in an exception
> hierarchy? I do not see any reason that any exception would have an IS-A
> relationship with any two parent classes. I view an exception of being a
> very specific error, but multiple inheritance implies that the exception
is
> simultaneously two types of errors.
Quoting from Section 14.2.2, The C++ Programming Language, 3rd edition
(Bjarne Stroustrop):
Not every grouping of exceptions is a tree structure. Often, an exception
belongs to two groups. For example:
class Netfile_err : public Network_err, File_system_err { /* ... */ };
Such a Netfile_err can be caught by functions dealing with network
exceptions:
[code snippet elided]
and also by functions dealing with file system exceptions:
[code snippet elided]
This nonhierarchical organization of error handling is important where
services, such as networking, are transparent to users. In this case, the
writer of [the code handling file system exceptions] might not even be aware
that a network is involved.
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk