Override


#1

The instructions are “Let’s try a more entertaining (if less realistic) example. Create a new class, Dragon, that inherits from Creature. Give your derived class a fight method that overrides Creature’s; instead of returning “Punch to the chops!”, it should return “Breathes fire!”.”

I have this

class Creature
def initialize(name)
@name = name
end

def fight
return "Punch to the chops!"
end
end

class Dragon < Creature
def fight
return "Breathes Fire!"
end
end

And I keep getting this error

It looks like your Dragon’s fight method returns “Breathes Fire!” instead of “Breathes fire!”

And this makes no sense to me


#2

Notice the difference?


#3

“Breathes Fire!” != “Breathes fire!”

Can you see the difference?


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.