Feb-01-2019, 04:24 PM
class SuperClass: def __init__(self, a1, a2): self.attribute1 = a1 self.attribute2 = a2 def getAttribute1(self): return self.attribute1 def setAttribute1(self, a1): self.attribute1 = a1 def getAttribute2(self): return self.attribute2 def setAttribute1(self, a2): self.attribute2 = a2 class SubClass(SuperClass): def getAttribute3(self): return self.attribute3 def setAttribute3(self, a3): elf.attribute3 = a3 def printMessage(self): print("My attributes are: ", self.getAttribute1(), \ self.getAttribute2(), self.getAttribute3()) testObject = SubClass("i", "am", "awesome!") testObject.printMessage()and when i run it i get this:
Error:Traceback (most recent call last):
File "/home/main.py", line 23, in <module>
testObject = SubClass("Hello", "world", "!!!")
TypeError: __init__() takes 3 positional arguments but 4 were given
what is that about?