Hi!
I need to implement the next situation:
class Foo
def Foo.greeting
"Hello! I'm a #{Name}"
end
end
class Bar1 < Foo
Name = "Good Guy"
end
class Bar2 < Foo
Name = "Bad Guy"
end
Bar1.greeting # -> Hello! I'm a Good Guy
Bar2.greeting # -> Hello! I'm a Bad Guy
This is does not work as well as I would try to define
class Foo
Name = "Unknown Guy"
end
The real situation is more sophistic, and may vary to instance
methods. IIn general, this is classic deferred (virtual)
implementation, but I have not found this in ruby.
Any ideas?
E-mail is preferred