76
GB
What is the output: class A{public:virtual int f(){return 1;} virtual int g(){return f()+1;}}; class B:public A{public:int f()override{return 2;}}; B b; cout<
IN
आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल इंट एफ(){रिटर्न 1;} वर्चुअल इंट जी(){रिटर्न एफ()+1;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f()ओवरराइड{वापसी 2;}}; बी बी; अदालत
A
3
3
B
2
2
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
b.g()=A::g()=f()+1=B::f()+1=2+1=3. Output: 3.
व्याख्या (हिन्दी)
b.g()=A::g()=f()+1=B::f()+1=2+1=3. आउटपुट: 3.