0
What is the output of the following C++ program?
#include <iostream>
using namespace std;
struct A { A() { cout << 1; } ~A() { cout << 3; } };
struct B : A { B() { cout << 2; } ~B() { cout << 4; } };
int main() { B x; }- A1342
- B1234
- C2143
- D1243
Correct answer: D