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;
}
#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
Related Questions on Introduction to C plus plus
What does the 'cin' object in C++ represent?
A. File output stream
B. File input stream
C. Standard output stream
D. Standard input stream

Join The Discussion