class Phone: IMEI=2020001 producer="apple" def call_by_4g(self): print("4g通话") class NFCReader: nfc_type="第五代" producer="apple" def read_card(self): print("读取NFC卡") def write_card(self): print("写nfc卡") class RemoteControl: rc_type="红外遥控" def control(self): print("红外遥控开启") class MyPhone(Phone,NFCReader,RemoteControl): pass #实例化某个对象 phone1=MyPhone() print(phone1.producer) phone1.write_card() phone1.control() ''' apple 写nfc卡 红外遥控开启 '''
标签:apple,重名,self,phone1,当父,print,class,def,属性 From: https://www.cnblogs.com/haha1988/p/17533379.html