(问答题)
使用类完成
妈妈长得很漂亮,爸爸iq很高,儿子继承了他们有优良基因,并且还弹得一手好钢琴。
(问答题)
使用类完成
妈妈长得很漂亮,爸爸iq很高,儿子继承了他们有优良基因,并且还弹得一手好钢琴。
class Mother:
def __init__(self):
self.beauty = 100
class Father:
def __init__(self):
self.IQ = 200
class Son(Mother, Father):
def play_piano(self):
print("I can play the piano!")
son = Son()
print("Son的美丽指数:", son.beauty)
print("Son的智商:", son.IQ)
son.play_piano()