|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
父类
class Name():
sum = 0
def __init__(self,name,age):
self.name = name
self.age = age
子类
from K1 import Name
class Abc(Name):
def __init__(self,school,name,age):
self.school = school
super(Name,self).__init__(name,age)
a = Abc("从杰爸","王从杰","从杰")
print(a.name)
print(a.age)
print(a.school)
出错
object.__init__() takes no arguments
File "E:\1234\name\t2\k2.py", line 5, in __init__
super(Name,self).__init__(name,age)
File "E:\1234\name\t2\k2.py", line 9, in <module>
a = Abc("从杰爸","王从杰","从杰") |
|