The Visitor Design Pattern
Visitors
- Encapsulate the variant behaviors.
- All conform to a set invocation interface.
- Provide different methods for different hosts.
Hosts
- Provide a consistent “hook” for visitors.
- Each different host calls only its desired method in the visitor.