有名对象,匿名对象

'''
有名对象,匿名对象
'''


class complex:
    def __init__(self,x,y):
        self.x=x
        self.y=y
    def show(self):
        print(self.x,'+',self.y,'i')


c1=complex(1,2)
c1.show()

complex(1,2).show()

'''
1 + 2 i
1 + 2 i
'''
原文地址:https://www.cnblogs.com/liangliangzz/p/11350146.html