How do I call a method defined in a base class from a derived class that overrides it?



How do I call a method defined in a base class from a derived class that overrides it?..

Answer / Gunjan Chaudhry

To call a method defined in a base class from a derived class that overrides it, you can use the super() function. Here's an example:n```pythonnclass Base:n def some_method(self): ...nclass Derived(Base):n def some_method(self): # Override some_methodn super().some_method() # Call some_method from the base class```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Explain garbage collection in python?

1 Answers  


What is key lambda in python?

1 Answers  


Is python a programming?

1 Answers  


Why was the language called as Python?

1 Answers  


How python supports encapsulation with respect to functions?

1 Answers  


Does amazon use python?

1 Answers  


What are some python projects for beginners?

1 Answers  


What is a lambda function?

5 Answers  


What are your weaknesses examples?

1 Answers  


Write a program to find the duplicates in a list?

1 Answers  


How can you prevent abnormal termination of a python program?

1 Answers  


What is flask python used for?

1 Answers  


Categories