Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why doesn Traversal use the Visitor pattern?

Pattern Traversal Visitor
0
10 Posted

Why doesn Traversal use the Visitor pattern?

0

Visitor was considered for inclusion in the Traversal module of the Level 2 DOM. There are negative as well as positive consequences to implementing the Visitor pattern. One of Visitor’s advantages over Iterator is that Visitor can handle structures where the objects don’t share a common ancestor class, which is not an issue when everything you’re looking at is derived from Node. Since most of the things a Visitor could do can be emulated with a switch statement driven by an iterator, we decided to defer this issue.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.