>>> class hello(object): ... def print_c(): ... print"hello world!" >>> hello().print_c() hello world!
>>> class child(hello): ... def print_c(self): ... hello().print_c() ... >>> child().print_c() hello world!
>>> class hello(object): ... def print_c(self): ... print"hello world!" ... >>> class child(hello): ... def print_c(self): ... super(child,self).print_c() ... >>> child().print_c() hello world!
class C(object): def minus(self,x): return x/2 class D(C): def minus(self,x): super(D, self).minus() print 'hello'
class A(object): def __init__(self): self.n = 10 def minus(self, m): self.n -= m class B(A): def __init__(self): self.n = 7 def minus(self, m): super(B,self).minus(m) self.n -= 2 b=B() b.minus(2) print b.n
class C(A): def __init__(self): self.n = 12 def minus(self, m): super(C,self).minus(m) self.n -= 5 class D(B, C): def __init__(self): self.n = 15 def minus(self, m): super(D,self).minus(m) self.n -= 2 d=D() d.minus(2) print d.n
D.__mro__ (<class '__main__.D'>, <class '__main__.B'>, <class '__main__.C'>, <class '__main__.A'>, <type 'object'>)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有