C++, catch user-defined exceptions in multiple blocks
问题 Suppose the following example. There are classes A-C derived from std::exception: #include <exception> #include <string> #include <iostream> class A : public std::exception { std::string a_text; public: A(const std::string & a_text_) : a_text(a_text_) {} virtual ~A() throw() { } }; class B : public A { const std::string b_text; public: B(const std::string &a_text_, const std::string & b_text_) : A(a_text_), b_text(b_text_) {} virtual ~B() throw() {} }; template <typename T> class C : public B