0
What is the output of the following C++ program?
#include <iostream>
using namespace std;
class P {
public:
int x;
P(int a) : x(a) {}
P operator+(P o) { return P(x * 10 + o.x); }
};
int main() {
P a(1), b(2), c(3);
cout << (a + b + c).x;
}- A6
- B15
- C321
- D123
Correct answer: D