76
GB
What is the output: class A{int x=0; public: void inc(){x++;} int get()const{return x;} A operator+(const A& o)const{A r; r.x=x+o.x; return r;}}; A a,b; a.inc();a.inc(); b.inc(); cout<<(a+b).get();
IN
आउटपुट क्या है: class A{int x=0; सार्वजनिक: void inc(){x++;} int get()const{return x;} A ऑपरेटर+(const A& o)const{A r; r.x=x+o.x; वापसी आर;}}; ए ए, बी; a.inc();a.inc(); b.inc(); अदालत
A
3
3
B
2
2
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
a.x=2, b.x=1. (a+b).x=3. Output: 3.
व्याख्या (हिन्दी)
a.x=2, b.x=1. (ए+बी).एक्स=3. आउटपुट: 3.