46
GB
What is the output: class Observable{vector> obs; public: void subscribe(function f){obs.push_back(f);} void notify(){for(auto& f:obs) f();}}; Observable o; int x=0; o.subscribe([&]{x++;}); o.subscribe([&]{x+=2;}); o.notify(); cout<
IN
आउटपुट क्या है: क्लास ऑब्जर्वेबल{वेक्टर ऑब्स; सार्वजनिक: शून्य सदस्यता(फ़ंक्शन f){obs.push_back(f);} शून्य सूचित(){for(auto& f:obs) f();}}; देखने योग्य ओ; int x=0; o.सदस्यता लें([&]{x++;}); o.सदस्यता लें([&]{x+=2;}); o.सूचित करें(); अदालत
A
3
3
B
1
1
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
x+=1+2=3. Output: 3.
व्याख्या (हिन्दी)
x+=1+2=3. आउटपुट: 3.