下划线重写

    a. 对象加减乘除
        class Foo(object):
            
            def __init__(self,age):
                self.age = age
                
            def __add__(self, other):
                # return self.age + other.age
                return Foo(self.age + other.age)
                
        obj1 = Foo(19)
        obj2 = Foo(18)

        obj3 = obj1 + obj2

推荐阅读更多精彩内容