Question 60Asked in Bihar STET 2024 Paper II Computer Science, 12 Jun 2024, Shift 1 (10:00 AM)

What does the term "method overriding" refer to in OOP?ओओपी में "विधि ओवरराइडिंग" शब्द क्या दर्शाता है?

ओओपी में "विधि ओवरराइडिंग" शब्द क्या दर्शाता है?
  1. ACreating multiple methods with the same name in a classएक कक्षा में एक ही नाम के साथ कई विधियां बनाना
  2. BDefining a method in a derived class with the same name as in the base classएक व्युत्पन्न वर्ग में एक विधि को उसी नाम के साथ परिभाषित करना जैसा कि आधार वर्ग में है।
  3. CReimplementing all methods in a class hierarchyवर्ग पदानुक्रम में सभी विधियों को पुन: लागू करना
  4. DDefining private methods in a classएक वर्ग में निजी तरीकों को परिभाषित करना
Show answerHide answer

Correct answer: (B) Defining a method in a derived class with the same name as in the base classएक व्युत्पन्न वर्ग में एक विधि को उसी नाम के साथ परिभाषित करना जैसा कि आधार वर्ग में है।

Explanation

Method overriding means a subclass redefines a method that has the same name, parameters and return type as one in its superclass. Same-name methods within one class with different parameters is overloading.Method overriding का अर्थ है कि subclass उस method को दोबारा परिभाषित करती है जिसका नाम, parameters और return type उसकी superclass के method जैसा ही हो। एक ही class में अलग parameters वाले समान नाम के methods overloading हैं।

From Bihar STET 2024 Paper II Computer Science PYQ, 12 Jun 2024, Shift 1 (10:00 AM)

This is question 60 of Bihar STET 2024 Paper II Computer Science PYQ, 12 Jun 2024, Shift 1 (10:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.