The ruby class-instance stuff is giving me a headache. I understand given this...
class Foo
@var = 'bar'
end
...that @var is a variable on the created class's instance.
But how do I create a sub-class overridable class variable?
Here is an example of what I would do in Python:
class Fish:
var = 'fish'
def v(self):
return self.var
class Trout(Fish):
var = 'trout'
class Salmon(Fish):
var = 'salmon'
print Trout().v()
print Salmon().v()
Which outputs:
trout
salmon
How do I do the same thing in ruby?