试图从超类 BasicToken继承 到子类 StableCoin
的值supply未被子类继承:StableCoin
有人可以解释为什么吗?
class BasicToken:
asset_class = "Crypto-Currency"
def __init__(self, symbol):
self.symbol = symbol
class StableCoin(BasicToken):
def __init__(self, color, supply):
self.color = color
self.supply = supply
icon = BasicToken('icx')
icxStable = StableCoin('DMM', ['Blue', 'White'])
print('Icon Symbol: '+ icon.symbol)
print('IcxStable Symbol: '+ icxStable.symbol)
的Error:
Traceback (most recent call last):
File "C:/Users/Samson/Documents/PythonCourse-master/Section_04/assignment_04.py", line 30, in <module>
print('IcxStable Symbol: '+ icxStable.symbol)
AttributeError: 'StableCoin' object has no attribute 'symbol'
杨魅力
相关分类