|
|
|
|
|
by btilly
5672 days ago
|
|
In more traditional OO languages, inheritance might be more limited... Explain. Class based inheritance, with a good metaprogramming model, is strictly more flexible than prototype based inheritance because you can easily implement the latter. The shortest implementation that I know of is the following Ruby one: Proto = Class.new(Class) # Beware: magic.
def Proto.clone
Class.new(self)
end
You can find out more about how to use that at http://snippets.dzone.com/posts/show/3378. |
|