Vidyalelo
C++ Programming · Q487

C++ miscellaneous

Programming · C++ Programming · question 487

Q487

What will be the output of the following C++ code? #include #include 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::operator delete
B.
B::operator delete
Answer
C.
Both A::operator delete & B::operator delete
D.
A:operator new

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board