Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
struct A
4.
{
5.
virtual ~A()
6.
{
7.
cout
Options:
A .  ~A()
B .  A :: operator delete[]
C .  B :: operator delete[]
D .  Warning
Answer: Option D

In this program, the behavior of the statement delete[] bp is undefined.
$ g++ a.cpp
a.cpp: In static member function 'static void A::operator delete [](void*, size_t)':
a.cpp:12: warning: deleting 'void*' is undefined
a.cpp: In static member function 'static void B::operator delete [](void*, size_t)':
a.cpp:20: warning: deleting 'void*' is undefined

$ a.out
~A()
~A()
~A()
A :: operator delete[]




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers