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