6.5 메서드 추가 하기

class Car():
def exclaim(self):
print("I'm a Car!")
class Yugo(Car):
def exclaim(self):
print("I'm Yugo! Much like a Car, but more Yugo-ish.")
def need_a_push(self):
print("A little help here?")
give_me_a_car = Car()
give_me_a_yugo = Yugo()
give_me_a_yugo.need_a_push()

A little help here?

give_me_a_car.need_a_push()
AttributeError Traceback (most recent call last)
<ipython-input-6-25de065dd6f4> in <module>()
----> 1 give_me_a_car.need_a_push()

AttributeError: 'Car' object has no attribute 'need_a_push'

Comments