父类

子类一

采用父类名.方法的方式调用父类中的初始化函数"
子类二

" 使用super(子类名,self).方法的方式调用父类的初始化函数,使用super()的方式需要在父类中继承object这个类,否则会报" TypeError: super() argument 1 must be type, not classobj"错误"
父类
子类一
采用父类名.方法的方式调用父类中的初始化函数"
子类二
" 使用super(子类名,self).方法的方式调用父类的初始化函数,使用super()的方式需要在父类中继承object这个类,否则会报" TypeError: super() argument 1 must be type, not classobj"错误"
本文标题:python继承二(实例)
本文链接:https://www.haomeiwen.com/subject/fsiqvttx.html
网友评论