Python doesn't support method (function) overloading by default. Method overloading is an important concept in object oriented programming where same method name can be used to perform different tasks based on the number of parameters or arguments passed to it.
class Area:
def CalcArea(self,a=None,b=None,c=None):
if a!=None and b!=None and c!=None:
return a*b*c
elif a!=None and b!=None:
return a*b
else:
return 0
polygon=Area()
print("Volume of Polygon is: ",polygon.CalcArea(4,5,8))
print("Area of Polygon is: ",polygon.CalcArea(5,6))
print("If zero sided polygon then the area is: ",polygon.CalcArea())
print("If one sided polygon then the area is: ",polygon.CalcArea(3))
The output of this code when executed is:
