🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

Python में child class parent class की properties कैसे access करती है?

How does a child class access the properties of a parent class in Python?

A
Composition / कम्पोज़ीशन
B
Inheritance / इनहेरिटेंस
C
Encapsulation / एनकैप्सुलेशन
D
Polymorphism / पॉलिमॉर्फ़िज़्म
Explanation

Python में जब कोई child class (उपवर्ग) किसी parent class (मूल वर्ग) की properties और methods को access करता है, तो इसे inheritance कहते हैं।

🔹 यह Object-Oriented Programming (OOP) की एक मुख्य विशेषता है।


🧪 उदाहरण (Example):

python

class Parent:
    def show(self):
        print("I am Parent")

class Child(Parent):
    pass

c = Child()
c.show()  # Output: I am Parent

 

In English:

Inheritance allows a child class to access and reuse the attributes and methods of a parent class in Python.

Correct Answer: B) Inheritance / इनहेरिटेंस

Latest Updates