박혜원
파이참에 강의자료와 같은 코드를 실행했는데 자꾸 오류가 납니다.
입력한 코드와 오류를 첨부하겠습니다.
class Father(object):
strHometown = "Jeju"
def __init__(self):
print("Father is created")
def doFatherThing(self):
print("Father's action")
def doRunning(self):
print("Slow")
class Mother(object):
strHometown = "Seoul"
def __init__(self):
print("Mother is created")
def doMotherThing(self):
print("Mother's action")
class Child(Father, Mother):
strName = "Moon"
def __init__(self):
super(child, self).__init__()
print("Child is created")
def doRunning(self):
print("Fast")
me = Child()
me.doFatherThing()
me.doMotherThing()
me.doRunning()
print(me.strHometown)
print(me.strName)
Traceback (most recent call last):
File "C:/Users/Hyewon Park/Practice/uml1.py", line 25, in <module>
me = Child()
File "C:/Users/Hyewon Park/Practice/uml1.py", line 20, in __init__
super(child, self).__init__()
NameError: name 'child' is not defined
comment