父构造函数默认不通过继承调用

时间:2018-09-29 16:50:34

标签: python inheritance

class parent():

    par1=
    def __init__(self):
        print("i am parent constr")

class child(parent):    
    def __init__(self):
        print("i am child constr")
    pass

c=child()

print(c.par1)

o / p是

i am child constr

问题-为什么此处未调用父类构造函数。

0 个答案:

没有答案
相关问题