301
GB
What is the output: class A{int x=1; public: int get(){return x;}}; class B:private A{public: int f(){return get();}}; B b; cout<
IN
आउटपुट क्या है: class A{int x=1; सार्वजनिक: int get(){return x;}}; कक्षा बी: निजी ए {सार्वजनिक: int f() {वापसी प्राप्त();}}; बी बी; अदालत
A
1
1
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
f() inside B can call get() (accessible via private inheritance). f()=get()=1. Output: 1.
व्याख्या (हिन्दी)
B के अंदर f() get() (निजी विरासत के माध्यम से पहुंच योग्य) को कॉल कर सकता है। f()=प्राप्त()=1. आउटपुट: 1.