0
以下是我在Python繼承中的示例代碼。super().__ init __()失敗,錯誤
class db_Conn:
hike = 1.04
def __init__(self,first,last,pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + '@ibm.com'
def full_name(self):
return'{} {}'. format(self.first, self.last)
def emp_raise(self):
self.pay = int(self.pay * self.hike)
emp1 = db_Conn('amitesh','sahay',50000)
emp2 = db_Conn('amit','sharma',60000)
class Dev(db_Conn):
def __init__(self,first,last,pay,prog):
super().__init__(first,last,pay)
self.prog = prog
dev1 = Dev('amitesh','sahay',50000, 'python')
dev2 = Dev('amit','sharma',60000,'scala')
print (dev1.prog)
print(dev2.email)
我得到下面的錯誤::
Traceback (most recent call last):
dev1 = Dev('amitesh','sahay',50000, 'python')
super().__init__(first,last,pay)
TypeError: super() takes at least 1 argument (0 given)
我無法找出什麼錯誤我在做。請幫忙....!!!