Question:
Which of the following is/are feature(s) of inheritance in OOPs?
Features:
i) Sub Class
ii) Super Class
iii) Reusability
iv) Operator Overloading
निम्नलिखित में से कौन से OOPs के इनहेरिटेंस में शामिल फ़ीचर हैं?
फ़ीचर:
i) सब-क्लास (Sub Class)
ii) सुपर क्लास (Super Class)
iii) रियूज़ेबिलिटी (Reusability)
iv) ऑपरेटर ओवरलोडिंग (Operator Overloading)
Options:
- iii only
- i and ii only
- ii and iii only
- i, ii and iii only
- केवल iii
- केवल i और ii
- केवल ii और iii
- केवल i, ii और iii
Correct Answer: d)
Explanation:
In Object-Oriented Programming (OOP):
– Super Class: The base/parent class whose attributes and methods are inherited.
– Sub Class: The derived/child class that inherits from the super class.
– Reusability: The primary benefit of inheritance, enabling existing code to be reused and extended without re-implementation.
– Operator Overloading: A compile-time polymorphism feature where operators have specialized behaviors for user-defined types; it is not a feature of inheritance.
Hence, i, ii, and iii only are features associated with inheritance. The correct option is d).
ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग (OOPs) में इनहेरिटेंस (Inheritance) के मुख्य पहलू:
– सुपर क्लास (Super Class): मूल या पैरेंट क्लास जिसके गुणों और विधियों को विरासत में लिया जाता है।
– सब-क्लास (Sub Class): व्युत्पन्न या चाइल्ड क्लास जो सुपर क्लास से गुण प्राप्त करती है।
– पुनः प्रयोज्यता (Reusability): इनहेरिटेंस का प्रमुख लाभ यह है कि यह पहले से लिखे गए कोड का पुन: उपयोग करने की अनुमति देता है।
– ऑपरेटर ओवरलोडिंग: यह पॉलीमॉर्फिज्म (Polymorphism) का हिस्सा है, इनहेरिटेंस का नहीं।
अतः केवल i, ii और iii इनहेरिटेंस के फ़ीचर हैं। सही उत्तर विकल्प d) है।