Ruby Foundations | 11module B
include A
def hello
"Hello from B"
end
endmodule C
include A
def hello
"Hello from C"
end
endclass D
include B
include C
endD.new.hello # => "Hello from C"And if we change the order of inclusion, the result changes correspondingly:
class D
include C
include B
endD.new.hello # => "Hello from B"In this last example, whereBis included last, the object graph looks like Figure 1-7
(for simplicity, pointers toObject andClass have been elided).
Figure 1-6. The diamond problem of multiple inheritance