python的super函数示例

    xiaoxiao2021-12-14  21

    开始:

    class A(object): def __init__(self): print("ctor A beg") print("ctor A end") class B(A): def __init__(self): print("ctor B beg") super(B, self).__init__() print("ctor B end") b = B() # 输出信息如下所示: # ctor B beg # ctor A beg # ctor A end # ctor B end

    完。

    转载请注明原文地址: https://ju.6miu.com/read-968374.html

    最新回复(0)