【发布时间】:2019-07-14 10:49:29
【问题描述】:
class animal(object):
def __init__(self,name):
self.name = name
def eat(self,food):
print("{} is eating".format(self.name,food))
class dog():
def fetch(self,thing):
print("{} get the {}".format(self.name,thing))
s = dog('r')
错误:回溯(最近一次调用最后一次):文件 “C:\EclipseWorkspaces\csse120\LearnPython\inheritance.py”,第 14 行,在 s = dog('r') TypeError: dog() 没有参数
Cant figure out whats wrong, please help.
【问题讨论】:
-
看起来像一个继承练习。 :-) 也许你忘了继承
class dog?
标签: python