python普通继承和super继承
来源:互联网 发布:如何安装开票软件 编辑:程序博客网 时间:2024/05/21 06:53
普通继承:
class FooParent(object):
def __init__(self):
self.parent='I\'m the parent.'
print 'Parent'
def bar(self, message):
print message, 'from Parent'
class FooChild(FooParent):
def __init__(self):
FooParent.__init__(self)
print 'Child'
def bar(self, message):
FooParent.bar(self, message)
print 'Child bar function. '
print self.parent
super继承:
class FooParent(object):
def __init__(self):
self.parent = 'I\'m the parent.'
print 'Parent'
def bar(self, message):
print message, 'from Parent'
class FooChild(FooParent):
def __init__(self):
super(FooChild, self).__init__()
print 'Child'
def bar(self, message):
super(FooChild, self).bar(message)
print 'Child bar function. '
print self.parent
父类一定要继承object !!!!
0 0
- python普通继承和super继承
- python 普通继承方式和super继承方式
- super继承和普通父类继承
- 关于Python中的类普通继承与super函数继承
- Python学习:多继承和super()
- Python的多重继承和super
- Python super继承详解
- python super 继承
- 继承中的this和super
- 继承和super的用法
- 【java】继承和super.getClass()
- super、继承
- 继承、super
- python继承中super的问题
- Python 类继承,__bases__, __mro__, super
- Python 类继承,__bases__, __mro__, super
- 关于python的继承,super关键字
- Python 中的继承之Super用法
- 知识点小结(一)--libgdx
- 如果看了此文你还不懂傅里叶变换,那就过来掐死我吧【完整版】
- Java 项目优化实战
- 【matlab】:matlab关于原图修改及画图的相关问题
- Java并发编程系列之十七:Condition接口
- python普通继承和super继承
- $.ajax()参数详解及标准写法
- Gradle sync failed: Out of memory: PermGen space
- 数据库系统概念学习04-数据模型
- 工作总结-给你的SDK瘦瘦身
- C# File类
- 在VS2012中使用GitHub
- VMware+Windgb+Win7 内核驱动调试
- 欢迎使用CSDN-markdown编辑器