我有一个Bank类,在其中设置了生成随机帐号的方法。我想将该帐号传递给另一个类SavingAccount,但是当我实例化我要从中传递的SavingAccount类时给出一个参数。
class Bank:
listOfBankAccountNumbers =[]
def makeAccountNumber(self):
while True:
self.accountNumber = random.randint(10000, 99999)
if self.accountNumber not in self.listOfBankAccountNumbers:
self.listOfBankAccountNumbers.append(self.accountNumber)
break
else:
continue
class SavingsAccount(Bank):
def __init__(self, account_ballance, accountNumber):
super.__init__(self, self.accountNumber)
self.account_ballance = account_ballance
我将非常乐意提供帮助。非常感谢