Question OOP-CTOR-0061
HardWhat is the output of this code?
#include <iostream>
using namespace std;
class M {
public:
M(int i) { cout << "M" << i << " "; }
};
class X {
M b, a;
public:
X() : a(1), b(2) { cout << "X"; }
};
int main() {
X x;
}
- A.
M2 M1 X
- B.
M1 M2 X
- C.
Sign up free to see the answer and a step-by-step explanation.