46
GB
What is the output: class A{public:int x=5; virtual int f(){return x;}}; class B:public A{public:int f()override{return x*2;}}; A a; B b; A&r=b; cout<
IN
आउटपुट क्या है: class A{public:int x=5; वर्चुअल int f(){रिटर्न x;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f()ओवरराइड{वापसी x*2;}}; ए ए; बी बी; ए&आर=बी; अदालत
A
510
510
B
55
55
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
a.f()=5; r.f() virtual dispatch: B::f()=5*2=10. Output: 510.
व्याख्या (हिन्दी)
a.f()=5; r.f() वर्चुअल प्रेषण: B::f()=5*2=10। आउटपुट: 510.