-
What is the output of this program?
#include <typeinfo>
#include <iostream>
using namespace std;
class N
{
public:
virtual ~N();
};
int main()
{
N* ptr = NULL;
try
{
cout << typeid(*ptr).name() << endl;
}
catch (bad_typeid)
{
cout << "Object is NULL" << endl;
}
}
-
- NULL
- Compilation Error
- Runtime Error
- Object is NULL
- None of these
Correct Option: D
In this program, We are using the bad typeid() for a. So it is arising an exception.