class Area(object):
def get_area(self):
return("WORKING FINE")
class Rectangle(Area):
def get_area(self,l,b):
self.l=l
self.b=b
return (self.l*self.b)
class Circle(Rectangle):
def get_area(self,r):
self.r=r
return (3.14*self.r*self.r)
obj=Circle()
print(obj.get_area())
print(obj.get_area(6,3))
obj.get_area requires an argument, r, and only one
so format would be obj.get_area(10) for example
I don't know why you call it overloading, as you are not overloading anything.
You only overload a class when yo are going to change the operation of one or more of the methods,
and that is done thusly:
import myclass
class circle(myclass):
Unrelated, but why is Circle extending Rectangle? They're very different, unrelated things, and anything that they might happen to share would be in the base Area class.