Design 2
Better solution:
Put each operation in a different class called a
visitor
Works well if we assume adding new node
types is uncommon
» We have to update all the visitors when a new
node type is added