Advertisements
Advertisements
Question
Explain the concept of overriding methods.
Code Writing
Explain
Advertisements
Solution
Method overriding happens when a derived class defines a method with the same name as a method in its base class. The derived-class version is called when the method is invoked using a derived-class object.
class Person(object):
def show(self):
print("Person")
class Student(Person):
def show(self):
print("Student")
shaalaa.com
Is there an error in this question or solution?
