DSSSB TGT CS Mock 03 – Question 132

Question:

In C++, what happens when a derived class defines a function with the same signature as a base class virtual function?
C++ में क्या होता है जब कोई व्युत्पन्न वर्ग (derived class) बेस क्लास वर्चुअल फ़ंक्शन के समान हस्ताक्षर वाले फ़ंक्शन को परिभाषित करता है?

Options:

  • Function Overriding (Dynamic / Runtime Polymorphism)
  • Function Overloading (Compile-time Polymorphism)
  • Operator Overloading
  • Compile-time syntax error
  • फ़ंक्शन ओवरराइडिंग (रनटाइम बहुरूपता)
  • फ़ंक्शन ओवरलोडिंग (कंपाइल-टाइम बहुरूपता)
  • ऑपरेटर ओवरलोडिंग
  • कंपाइल-टाइम सिंटैक्स त्रुटि

Correct Answer: a)

Explanation:

Overriding occurs when a derived class provides a specific implementation of a virtual function declared in its base class with the exact same name, return type, and parameters, resolved at runtime via the virtual method table (vtable).
जब डिराइव्ड क्लास बेस क्लास के वर्चुअल फ़ंक्शन को उसी नाम और पैरामीटर के साथ पुनः परिभाषित करती है, तो इसे रनटाइम पॉलीमॉर्फिज्म (फंक्शन ओवरराइडिंग) कहा जाता है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top