Classe Python - Super variável
O pedaço de código abaixo está me dando um erro por algum motivo, alguém pode me dizer qual seria o problema ..
Basicamente, eu crio 2 classes Point & Circle .. O círculo está tentando herdar a classe Point.
Code:
class Point():
x = 0.0
y = 0.0
def __init__(self, x, y):
self.x = x
self.y = y
print("Point constructor")
def ToString(self):
return "{X:" + str(self.x) + ",Y:" + str(self.y) + "}"
class Circle(Point):
radius = 0.0
def __init__(self, x, y, radius):
super(Point,self).__init__(x,y)
self.radius = radius
print("Circle constructor")
def ToString(self):
return super().ToString() + \
",{RADIUS=" + str(self.radius) + "}"
if __name__=='__main__':
newpoint = Point(10,20)
newcircle = Circle(10,20,0)
Erro:
C:\Python27>python Point.py
Point constructor
Traceback (most recent call last):
File "Point.py", line 29, in <module>
newcircle = Circle(10,20,0)
File "Point.py", line 18, in __init__
super().__init__(x,y)
TypeError: super() takes at least 1 argument (0 given)