Method Overloading and Method Overriding in python

Method Overloading in python
class Student:

def __init__(self, m1, m2):
self.m1 = m1
self.m2 = m2

def sum(self, a, b):
s = a + b

return s


s1 = Student(58, 69)
print(s1.sum(89, 53))
Output
142
Method Overloading Method

    Methods in Python can be called with zero, one, or more parameters. This process of calling the same method in different ways is called method overloading
class Student:

def __init__(self, m1, m2):
self.m1 = m1
self.m2 = m2

def sum(self, a=None, b=None, c = None):
# s = a + b
# return s
s = 0
if a != None and b != None and c != None:
s = a + b + c
elif a != None and b != None:
s = a + b
else:
s = a

return s


s1 = Student(58, 69)
print(s1.sum(89, 53))
142
Method Overriding

    Method overriding is an ability of any object-oriented programming language that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes.
class A:

def show(self):
print("in A Show")

class B(A):

def show(self):
print("in B Show")

a1 = B()
a1.show()
Output
in B show