class Fu:
def test(self):
print('九阳神功...')
class Zi(Fu):
def test(self):
print('九阳神功...')
super().test()
print('乾坤大挪移...')
#实例化子类对象
zi = Zi()
zi.test()
#定义旧手机类
class OldPhone:
#打电话:
def call(self,name,msg):
print('正在给%s打电话,内容为:%s' % (name,msg))
#发短信:
def sendMSG(self,name,msg):
print('正在给%s发短信,内容为:%s' % (name,msg))
#定义新手机类
class NewPhone(OldPhone):
# 打电话:
def call(self, name, msg):
print('显示归属地和大头贴')
# 发短信:
def sendMSG(self, name, msg):
super().sendMSG(name,msg)
print('正在发送表情包...')
#实例化子类对象:
np=NewPhone()
np.call('苍老师','约吗?')
np.sendMSG('小泽老师','么么哒!!')