3 ms·
I see. His example is meaningful only in a language that does not provide a convention for handling missing methods in the composed class. For instance, in ruby
by 0x44 19y ago
I see. His example is meaningful only in a language that does not provide a convention for handling missing methods in the composed class. For instance, in ruby, I can distill your example to:
class Parent
def a; ... end
def b; ... end
def c; ... end
...
def zzzz; ... end
end
class B
def initialize
@parent = Parent.new
end
def b; special logic end
def method_missing(methodname)
@parent.send(methodname)
end
end