Vidyalelo
C++ Programming · Q70

Object Oriented Programming in C++

Programming · C++ Programming · question 70

Q70

What will be the output of the following C++ code? #include using namespace std; class A public: A() cout<<"Constructor called "; ~A() cout<<"Destructor called "; ; int main(int argc, char const *argv[]) A *a = new A[5]; delete a; return 0;

A.
"Constructor called" five times and then "Destructor called" five times
B.
"Constructor called" five times and then "Destructor called" once
C.
Error
D.
Segmentation fault
Answer

Answer: Option D

Solution

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