首页 > 应用开发 > > python 实例化对象 报错问题
class People():
def init(self,height,money):
self.height=height
self.money=money
class Man(People):
def init(self,age):
self.age = age
Man(11,22)
TypeError: init() takes 2 positional arguments but 3 were given
[](https://img2018.cnblogs.com/q/1296045/201903/1296045-20190328140226935-1631748365.png
子类 Man() 初始化函数 只需要传入 1个参数,实例化时 传入 2个参数, 但是 错误提示 说 传入了3个, 是什么原因
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1377/viewspace-3158946/ ,如需转载,请注明出处,否则将追究法律责任。