Vidyalelo
C++ Programming · Q608

C++ miscellaneous

Programming · C++ Programming · question 608

Q608

What will be the output of the following C++ code? #include #include using namespace std; struct MyException : public exception const char * what () const throw () return "C++ Exception"; ; int main() try throw MyException(); catch(MyException& e) cout << "Exception caught" << std::endl; cout << e.what() << std::endl; catch(std::exception& e)

A.
C++ Exception
B.
Exception caught
C.
Exception caught
C++ Exception
Answer
D.
Error

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board