c_-_c_exception_handling:derived_class_exceptions
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.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1