adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    struct A
    {
        virtual ~A()
        { 
            cout << "~A()" << endl; 
        }
        void operator delete[](void* p, size_t)
        {
            cout << "A :: operator delete[]" << endl;
            delete [] p;
        }
    };
    struct B : A 
    {
        void operator delete[](void* p, size_t) 
        {
            cout << "B :: operator delete[]" << endl;
            delete [] p;
        }
    };
    int main() 
    {
        A* bp = new B[3];
        delete[] bp;
    };

a.

~A()

b.

A :: operator delete[].

c.

B :: operator delete[].

d.

Warning

Answer: (d).Warning

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?