C++ | Exception Handling | Question 6
#include <iostream>using namespace std; int main(){ try { throw 10; } catch (...) { cout << "default exception\n"; } catch (int param) { cout << "int exception\n"; } return 0;} |
(A) default exception
(B) int exception
(C) Compiler Error
Answer: (C)
Explanation: It is compiler error to put catch all block before any other catch. The catch(…) must be the last catch block.
Quiz of this Question



