Examveda

What will be the output of the following C++ code?
#include<iostream>
using namespace std;
class A
{
  ~A(){
     cout<<"Destructor called\n";
   }
};
int main()
{
    A *a1 = new A();
    A *a2 = new A();
    return 0;
}

A. Destructor called

B. Destructor called
Destructor called

C. Error

D. Nothing is printed

Answer: Option D


Join The Discussion

Related Questions on Introduction to C plus plus