SE450: The VISITOR Pattern [51/55] Previous pageContentsNext page

Solution

  1. Define a visitor interface type that has methods for visiting elements of each of the given types.
  2. Each element class defines an accept method that invokes the matching element visitation method on the visitor parameter.
  3. To implement an operation, define a class that implements the visitor interface type and supplies the operation s action for each element type.

Previous pageContentsNext page