c
class People(object):
def __init__(self) -> None:
self.name=__class__.__name__
print("初始化")
print("start......")
def setage(self,age):
print("年龄是-->:%s" %age)
def getname(self):
return self.name
p=People()
p.setage(10)
print(p.getname())
# TypeError: People.setage() takes 1 positional argument but 2 were given
# 解决方法类函数中添加self