Advanced Ruby
Q88 / 100

How does "Object#method_missing" combined with "respond_to_missing?" form a complete dynamic method pattern?

Correct! Well done.

Incorrect.

The correct answer is B) method_missing handles the actual dynamic dispatch, while respond_to_missing? should be overridden so that respond_to? correctly reports true for the dynamically handled methods, keeping introspection consistent

B

Correct Answer

method_missing handles the actual dynamic dispatch, while respond_to_missing? should be overridden so that respond_to? correctly reports true for the dynamically handled methods, keeping introspection consistent

Explanation

Without overriding respond_to_missing?, respond_to? would incorrectly return false for methods that method_missing actually handles, breaking duck-typing checks performed by other code.

Progress
88/100