• Home
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Archived
  • About
Design Patterns | Visitor
  1. References
  2. Example
    • The Visitor
    • The Concrete Visitor
    • The Element
    • The Concrete Element (1)
    • The Concrete Element (2)
    • A simple class to test the Visitor design pattern

  1. References
    • Definition: (source: http://en.wikipedia.org/wiki/Visitor_pattern)

      The visitor design pattern is a way of separating an algorithm from an object structure on which it operates.
      A practical result of this separation is the ability to add new operations to existing object structures without modifying those structures.

    • Class diagram: (source: http://en.wikipedia.org/wiki/Visitor_pattern)

      Visitor Pattern
  2. Example
    • The Visitor:


    • The Concrete Visitor:


    • The Element:


    • The Concrete Element (1):


    • The Concrete Element (2):


    • A simple class to test the Visitor design pattern:


© 2025  mtitek