How to implement method overloading in python?

Description

To implement method overloading in python3.

Method overloading:

   Given a single method or function,  we can specify the  number of parameters our self.

    To overload a method by passing multiple  parameters.

#class creation
class overload:
#sample method
def over_load(self,name=None):
if name is not None:
print(‘over’,name)
else:
print(‘over’)

#object creation
m=overload()

#method calling statement
m.over_load()
m.over_load(‘loading’)

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit