有名对象,匿名对象

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


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
'''

 

posted @ 2019-08-14 10:05  青春叛逆者  阅读(149)  评论(0编辑  收藏  举报