码迷,mamicode.com
首页 > 编程语言 > 详细

剑指offer python版 赋值运算符

时间:2018-10-25 10:58:41      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:pre   other   pytho   add   init   运算符   剑指offer   赋值运算   style   

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)
        

 

剑指offer python版 赋值运算符

标签:pre   other   pytho   add   init   运算符   剑指offer   赋值运算   style   

原文地址:https://www.cnblogs.com/xzm123/p/9847776.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!