Override! 13/20 Problem


#1

I am attempting to finish the Override! problem. I don't see anything wrong with the code, but when I save and submit it, I get the error message "Oops, try again. It looks like your Dragon's fight method returns 'Punch to the chops!' instead of 'Breathes fire!'" I've refreshed the page several times and still get the same error message. Any help as to why this is happening and how to correct it would be greatly appreciated.

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

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

Add your code below!

class Dragon < Creature
def fignt
return "Breathes fire!"
end

end

puff = Dragon.new("Puff")
puff.fight


#2
def fignt

and

def fight

#3

Ugh. I keep mistyping things. I guess I need new glasses.

Thank you for your help.


#4

This worked for me pretty good:

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


#5

Hi betojimenez!

What does your program return? mine returns 'nil' instead of 'Breathes fire!' I can't figure out why.

Add your code below!

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


#6

I don't know if i'm right because I'm quite new to this, but, i think it returns nil because you are not calling the class anywhere, therefore the program don't have anything to show so it shows you a nil.

Try calling fight method of both classes and it should show you how Dragon overrides the Creature one


#7

Here is my code -
class Dragon < Creature
def fight
return "Breath fire!"
end
end

However, I got the following message "superclass mismatch for class Dragon". Any one has seen this before?


#8

@2dudog
@dmuchu
Please start a new thread with your own code + question + error message.


#9

Never mind. I did a refresh and it solved the problem.


#10

I recharged the page and its ok!