class Init(object):
def __init__(self,v):
print("init")
self.val = v
class Add2(Init):
def __init__(self,val):
print("Add2")
super(Add2,self).__init__(val)
print(self.val)
self.val +=2
class Mult(Init):
def __init__(self,val):
print("Mult")
super(Mult,self).__init__(val)
self.val *=5
class HaHa(Init):
def __init__(self,val):
print("哈哈")
super(HaHa,self).__init__(val)
self.val /=5
class Pro(Add2,Mult,HaHa):
pass
class Incr(Pro):
def __init__(self,val):
super(Incr,self).__init__(val)
self.val += 1
p = Incr(5)
print(p.val)
c = Add2(2)
print(c.val)
# Add2
# Mult
# 哈哈
# init
# 5.0
# 8.0
# Add2
# init
# 2
# 4