























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The visitor pattern is a design pattern that allows adding new operations to classes without changing them. In this document, we explore the use of the visitor pattern for expression trees, where we define two class hierarchies: one for the elements being operated on and one for the visitors that define operations on the elements. Each object structure, such as an expression tree, will have an associated visitor class, and the visitor will define visit operations for each concrete class. The visitor will traverse the structure and perform the desired operation on each element. The visitor pattern achieves this by using a technique called double-dispatch, where the operation used to fulfill a request is determined by the name of the request and the types of both the receiver and the visitor.
Typology: Papers
1 / 31
This page cannot be seen from the preview
Don't miss anything!
























Stephen Wagner
Michigan State University