13. Imitating Multiple Inheritance

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

(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
1 Like

thx very much for the tips

1 Like

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