Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubysingleton eigenclassSingle-choice MCQ

Calling `d.singleton_class.prepend(P)` and then `d.foo` returns `"P->D"`. What does prepending to the singleton class do to the lookup order for that one object?

module P; def foo; "P->" + super; end; end class D; def foo; "D"; end; end d = D.new d.singleton_class.prepend(P) d.foo # => "P->D"