python invoke super parent method
2012-11-27 16:18
417 查看
1 #!/usr/bin/env python
2 #encoding=utf-8
3 class A(object):
4 def __init__(self):
5 print "a init"
6 print self.__class__
7
8 def do(self):
9 print self.__class__.__name__
10 class B(A):
11 def __init__(self):
12 #A.__init__(self)
13 super(B,self).__init__()
14 print "b init"
15
16 def do(self):
17 print "ok buddy"
18 super(B,self).do()
19
20 b=B()
21 b.do()
2 #encoding=utf-8
3 class A(object):
4 def __init__(self):
5 print "a init"
6 print self.__class__
7
8 def do(self):
9 print self.__class__.__name__
10 class B(A):
11 def __init__(self):
12 #A.__init__(self)
13 super(B,self).__init__()
14 print "b init"
15
16 def do(self):
17 print "ok buddy"
18 super(B,self).do()
19
20 b=B()
21 b.do()
相关文章推荐
- python the method of super function
- python Parent.__init()和super(Child, self)的区别
- python super()和classmethod
- python old-style inherit invoke parent member way
- Python child, parent, super CLASS
- 安卓开发——报错:Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null
- Python3基础 super层层调用父类的__init__方法 子类的__init__覆盖了父类的__init__的解决方法
- Python, file readline() method
- python使用super()出现错误解决办法
- python @,@staticmethod,@classmethod
- Python类的方法(method):super的用法
- Attempt to invoke virtual method 'void android.app.ActionBar.hide()' on a null object reference
- Python super执行基类的构造方法
- Attempt to invoke interface method 'java.lang.Object[] java.util.Collection.toArray()' on a null obj
- python 编译错误TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
- Method的Invoke方法
- java反射机制详解 及 Method.invoke解释 getMethod
- python2.7 使用super关键词 报错 TypeError: must be type, not&n
- java反射机制详解 及 Method.invoke解释 getMethod
- Android程序报错:java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.