"Stephen torri"
To do virtual inheritance I was under the belief that the base class had only pure virtual methods. Each subclass then implements the virtual methods. Is this what was intended or am I misunderstanding the term virtual inheritance?
Yes. See http://tinyurl.com/5sgv8 [25.9].
Often you can get away with:
class Data_Exception : public std::exception { public: Data_Exception(int code) : code_(code) { } virtual const char* what() const throw() { [return result of looking up code in a table of error messages.] } private: int code; };
So each class has a predefined table of int/string pairs. This table should be a static member of this class because there is not need to have multiple instances.
Can you use a std::map or sgi hash_map to construct the table?
Yes. But if you constuct the table on first use, and the purpose of the table is partly to avoid running out of memory when constructing exceptions, it's probably better to use a built-in array.
Stephen
Jonathan