首页 > 编程语言 > 详细

python之super()

时间:2020-05-20 00:42:34      阅读:47      评论:0      收藏:0      [点我收藏+]
import torch

class A:
def __init__(self,ax):
print("%s in A" % ax)
print("%s in y.B" % self.y)

class B(A):
def __init__(self,bx):
self.y=200;
#三者相同
# super(B,self).__init__(bx)
# super(B,B).__init__(self,bx)
A.__init__(self,bx)

myB=B(100)

python之super()

原文:https://www.cnblogs.com/szcloud/p/12920479.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!