module A; end
module B; end
class C; end
class D < C; end
d = D.new
D.send(:include, A)
d.extend(B)
d_meta = class << d; self; end
d.class.ancestors
=> [D, A, C, Object, Kernel, BasicObject]
d_meta.ancestors
=> [B, D, A, C, Object, Kernel, BasicObject]
and to me, benefits of composition over inheritance is that it doesn't modify object dispatch hierarchy.
PS: pls comment here.