What will be the output of the following C++ code? [code] #include <new> #include <iostream> using namespace std; struct

Trần Vũ

New member
What will be the output of the following C++ code?
Code:
    #include <new>
    #include <iostream>
    using namespace std;
    struct A 
    {
        virtual ~A() {  };
        void operator delete(void* p) 
        {
            cout << "A :: operator delete" << endl;
        }
    };
    struct B : A 
    {
        void operator delete(void* p) 
        {
            cout << "B :: operator delete" << endl;
        }
    };
    int main() 
    {
        A* ap = new B;
        delete ap;
    }
A. A::eek:perator delete
B. B::eek:perator delete
C. Both A::eek:perator delete & B::eek:perator delete
D. A:eek:perator new
 

Tìm kiếm

Back
Top