剑指offer python版 赋值运算符

class aa(object):
    def __init__(self,x):
        self.val=x
        
    def __add__(self,other):
        x=self.val-other.val
        return x
        
        
a=aa(10)
b=aa(2)

c=b+a


print(c)
        

 

posted @ 2018-10-25 09:11  findtruth123  阅读(163)  评论(0编辑  收藏  举报