46
GB
What is the output: class A{int x=5; public: A& setX(int v){x=v; return *this;} int getX()const{return x;}}; A a; cout<
IN
आउटपुट क्या है: class A{int x=5; सार्वजनिक: A& setX(int v){x=v; वापसी *यह;} int getX() स्थिरांक{वापसी x;}}; ए ए; अदालत
A
20
20
B
10
10
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
setX(10) returns *this; setX(20) sets x=20; getX()=20. Output: 20.
व्याख्या (हिन्दी)
setX(10) रिटर्न *यह; setX(20) सेट x=20; getX()=20. आउटपुट: 20.