What is the term for defining multiple methods in a class with the same name…
2025
What is the term for defining multiple methods in a class with the same name but different parameters?
Answer: B. Overloading — Method overloading is a feature in object-oriented programming where multiple methods in the same class can have the same name but different parameters. This…
- A.
Overriding
- B.
Overloading
- C.
Inheriting
- D.
Inheritance
Attempted by 144 students.
Show answer & explanation
Correct answer: B
Method overloading is a feature in object-oriented programming where multiple methods in the same class can have the same name but different parameters. This allows a class to perform different tasks based on the number, type, or order of the parameters passed. The method is selected at compile time based on the method signature. This concept is commonly used to provide flexibility in function calls.
हिन्दी उत्तर: विधि ओवरलोडिंग वस्तु-निर्देशित प्रोग्रामिंग में एक ऐसी विशेषता है जहाँ एक ही क्लास में एक ही नाम के कई विधियाँ अलग-अलग पैरामीटर्स के साथ हो सकती हैं। यह वर्ग को पैरामीटर्स की संख्या, प्रकार या क्रम के आधार पर विभिन्न कार्य करने की अनुमति देता है। विधि का चयन कंपाइल समय पर विधि सिग्नेचर के आधार पर किया जाता है। यह विधि कॉल में लचीलापन प्रदान करने के लिए आम तौर पर उपयोग किया जाता है।