The Visitor Pattern

  • Adam Freeman


The visitor pattern is similar to the strategy pattern in that it allows the behavior of a class to be extended without modifying its source code or creating a new subclass, except that the visitor pattern is applied to collections of heterogeneous objects. Table 25-1 puts the visitor pattern into context.


Conditional Statement Return Total Unknown Type Context Class Shape Class 

Copyright information

© Adam Freeman 2015

Authors and Affiliations

  • Adam Freeman
    • 1
  1. 1.ChicagoUnited States

Personalised recommendations