Question
#include <iostream>
#include <exception>
using namespace std;
class myexc: public exception
{
virtual const char* what() const throw()
{
return "My exception";
}
} myex;
int main ()
{
try
{
throw myex;
}
catch (exception& e)
{
cout << e.what() << endl;
}
return 0;
}
a.
My
b.
My exception
c.
No exception
d.
none of the mentioned
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which of the following is best to include under try block?
View solution
Q. What are the perdefined exceptions in c++?
View solution
Q. A default catch block catches
View solution
Q. Adding a derived class to a base class requires fundamental changes to the base class
View solution
Q. If you create an instantiation of a class template with an int, and then create a second instantiation with a double, then
View solution
Q. The type to be used in an instantiation of a class template follows ________
View solution
Q. When an object-oriented program detects an error within a function, the function _________
View solution
Q. When you create a derived class and instantiate an object _____
View solution
Q. A function in a derived class that has the same name as a function in the parent class
View solution
Q. When a function includes a throw statement for errors, the call to the potentially offending function should be placed within a _____ block
View solution
Q. In a C++ program, which of the following can be thrown?
View solution
Q. You must provide a constructor for a derived class
View solution
Q. If a derived class uses the public access specifier, then _____
View solution
Q. You _____ write your own container classes
View solution
Q. If an integer object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is
View solution
Q. You separate a derived class name from its access specifier with
View solution
Q. To use a template class member function, use the ________ with the instantiation
View solution
Q. When a class is derived from another derived class, the newly derived class
View solution
Q. With a template class, _____ type is generic
View solution
Q. Template classes that have already been written to perform common class tasks are called _____
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!