# 1.定义一个类(不限定定义哪个类):
# 要求: a.需要有一个类变量
# b.需要有>=2个的对象变量
# c.定义一个方法:打印类变量和对象变量
# d.使用print打印对象->输出为This is a object
# e.实例化两个对象:且两个对象相加等于2
# f.为对象添加一个临时变量temp_var
class A:
type = "A"
def __init__(self, a, b):
self.a = a
self.b = b
def print_info(self):
print(A.type, self.a, self.b)
def __str__(self):
return "This is a object"
def __add__(self, other):
return 2
a1 = A(1, 2)
a1.print_info()
print(a1)
print(a1+A(3, 4))
a1.temp_var = "aa"
print(a1.temp_var)



