Python构造函数有哪几种
Python构造函数有哪几种
Python中的构造函数是__init__函数
Python中子类如果定义了构造函数,父类的构造函数是不会履行的。
__init__函数使用方法:
class A:
def __init__(self, name):
self.name = name
class B(A):
def __init__(self, age):
self.age = age
文章来源:丸子建站
文章标题:Python构造函数有哪几种
https://www.wanzijz.com/view/4415.html