3
What will be the output of the program?
#include <iostream>
using namespace std;
class A {
public:
int x = 1;
A& add(int n) { x += n; return *this; }
};
int main() {
A a;
a.add(2).add(3);
cout << a.x << endl;
return 0;
}Medium