In the Visitor pattern, what mechanism allows new operations to be added without modifying the element classes?
-
A
Elements call accept(visitor), which dispatches to the correct visitor method via double dispatch
-
B
Elements inherit from a common visitor base class
-
C
The visitor uses reflection to inspect element types at runtime
-
D
New visitor subclasses override the element's methods directly