Advanced
Object-Oriented Programming Concepts
Q82 / 100
How does the "Visitor" design pattern relate to double dispatch?
Correct! Well done.
Incorrect.
The correct answer is A) It simulates double dispatch by having elements accept a visitor, which then calls a type-specific visit method on itself
A
Correct Answer
It simulates double dispatch by having elements accept a visitor, which then calls a type-specific visit method on itself
Explanation
The Visitor pattern lets new operations be added to a class hierarchy without modifying the classes, by combining the element's accept() call with the visitor's overloaded visit() methods, achieving double dispatch.
Progress
82/100