views:

58

answers:

1

We have a class Car defined like this in a car.rb file

class Car
end

then, we have another class Car defined in electric/car.rb

require "../car.rb"
module Electric
  class Car < Car
  end
end

Unfortunately, it seems that we can't inherit from the first class. Why is that?

+3  A: 

Avoid any ambiguity by using the fully qualified name of Car:

module Electric
  class Car < ::Car
  end
end
bltxd
Good! That's what I was looking for ;)
Julien Genestoux