c_-_c_exception_handling:derived_class_exceptions
This is an old revision of the document!
C - C++ Exception Handling - Derived Class Exceptions
#include <iostream> using namespace std; class B { }; class D: public B { }; int main() { D derived; try { throw derived; } catch(B b) { cout << "Caught a base class.\n"; } catch(D d) { cout << "This won't execute.\n"; } return 0; }
c_-_c_exception_handling/derived_class_exceptions.1507804977.txt.gz · Last modified: 2020/07/15 09:30 (external edit)