''' 有名对象,匿名对象 ''' 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 '''
''' 有名对象,匿名对象 ''' 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