Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 15)
15.
In Python, what happens when a subclass defines a method with the same name as a method in its superclass?
The superclass method is automatically overridden
The subclass method is ignored
An error occurs, and the program crashes
The subclass method overrides the superclass method
Answer: Option
Explanation:
In Python, if a subclass defines a method with the same name as a method in its superclass, the subclass method will override the superclass method.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.