Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here the host structure is IntList and its concrete subclasses, and the visitor is any extrinsic operation to be performed on the IntList host. Instead of adding methods to IntList to perform additional operations, we write visitors.

...

NOTE

...

: Visitors that take no arguments should be written as Singletons.
We now translate code we wrote using the interpreter pattern on IntList in previous labs using visitors instead.

...