output()
output()
to list structure and handlingNode
, Leaf
, and List
, and any of their derived classesAdd operations to classes without changing them
visit()
is passed a Node*
, only the visit(Node*)
is called, even if the parameter is a Leaf
or List
The exact method call depends on the name of the method and the calling object
object->operation(argument);
it is object and operationobject
argument
The exact method called depends on the name of the method, the calling object, and the rest of the arguments
Node
, Leaf
, or List
visit(Node*)
an empty method that does nothing (a NOP) so a visitor can ignore a particular type of Node