Static type of the exception object
问题 I read the following from C++ Primer (5th edition, Section 18.1.1): "When we throw an expression, the static, compile-time type of that expression determines the type of the exception object." So I tried the following code: #include <iostream> class Base{ public: virtual void print(std::ostream& os){os << "Base\n";} }; class Derived: public Base{ public: void print(std::ostream& os){os << "Derived\n";} }; int main(){ try{ Derived d; Base &b = d; b.print(std::cout); //line 1 throw b; } catch