13. Imitating Multiple Inheritance


#1

I keep getting this said as a wrong answer, with the error that comes up being "Oops, try again. Did you create a module called MartialArts?"

module MartialArts
def swordsman
puts "I'm a swordsman."
end
end

class Ninja include MartialArts
def initialize(clan)
@clan = clan
end
end

class Samurai include MartialArts

def initialize(shogun)
@shogun = shogun
end
end

Please tell me what I did wrong


#2

(ruby):9: syntax error, unexpected tIDENTIFIER, expecting '<' or ';' or '\n'
class Ninja include MartialArts
^

Write it this way, instead,

  class Ninja
    include MartialArts

and

  class Samurai
    include MartialArts

#3

thx very much for the tips


#4

A post was split to a new topic: Won't pass me?