1.

What is the output of this program?
#include <iostream>
#include <new>
using namespace std;
struct N
{
virtual ~N() { };
void operator delete(void* ptr1)
{
cout << "N :: operator delete" << endl;
}
};
struct M : N
{
void operator delete(void* ptr1)
{
cout << "M :: operator delete" << endl;
}
};
int main()
{
N* ptr2 = new M;
delete ptr2;
}

A. Compilation Error
B. N :: operator delete
C. M :: operator delete
D. Runtime Error
E. None of these
Answer» D. Runtime Error


Discussion

No Comment Found

Related MCQs