Bird
Raised Fist0

In Python, if a child class overrides a method but still wants to use the parent class's version inside it, which keyword is used?

easy🧠 Conceptual Q2 of Q15
Python - Polymorphism and Dynamic Behavior
In Python, if a child class overrides a method but still wants to use the parent class's version inside it, which keyword is used?
Aparent()
Bself
Cbase()
Dsuper()
Step-by-Step Solution
Solution:
  1. Step 1: Identify how to access parent method

    Python uses the super() function to call a method from the parent class inside the child class.
  2. Step 2: Usage in overriding method

    Inside the overridden method, calling super().method_name() runs the parent's method.
  3. Final Answer:

    super() -> Option D
  4. Quick Check:

    Use super() to call parent method inside child [OK]
Quick Trick: Use super() to call parent method inside child method [OK]
Common Mistakes:
MISTAKES
  • Using self instead of super() to call parent method
  • Trying parent() or base() which don't exist
  • Not calling parent method at all

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes