I'm trying to understand inheritance:
class Car
@@wheels = 4
def wheel
@@wheels
end
end
class StretchLimo < Car
@@wheels = 6
def whee
@@wheels
end
def turn_on_television
end
end
I instantiate some objects like so:
moe = Car.new
larry = StretchLimo.new
When I do moe.wheel, I get 6, when I'm expecting 4.
The Ruby tutorial I'm following says it's supposed to be 4. Larry.whee should obviously return 6.
By the way, the "wheel" and "whee" functions I added so I could see the values. Can anyone explain what's wrong here?