运行时不会产生任何输出
class Levels:
def __int__(self):
print("Welcome to Constructors")
a = Levels()
b = Levels()
构造函数声明的正确语法:
def __init__(self):
# body of the constructor
示例:
class Levels:
def __init__(self):
print('Welcome to Constructors')
a = Levels()