# -*- coding:utf-8 -*- class Alipay(): def __init__(self,money): self.money = money def pay(self): print('使用阿里支付了%s' % self.money) class Jdpay(): def __init__(self,money): self.money = money def pay(self): print('使用京东支付了%s' % self.money) def pay(obj): # 定义一个函数,统一调用接口 obj.pay() a1 = Alipay(200) j1 = Jdpay(100) pay(a1) pay(j1)