Design Pattern Examples
Overview of object-oriented design patterns
Visitor Class Reference

All visitors must implement this base class and then override one or more of the VisitXXX() methods, depending on which shop type the visitor class is interested in. More...

Inheritance diagram for Visitor:
Inheritance graph
Collaboration diagram for Visitor:
Collaboration graph

Public Member Functions

virtual void VisitRestaurant (Visitor_Restaurant shop)
 Let the visitor visit a Visitor_Restaurant shop.
 
virtual void VisitButcher (Visitor_Butcher shop)
 Let the visitor visit a Visitor_Butcher shop.
 
virtual void VisitBaker (Visitor_Baker shop)
 Let the visitor visit a Visitor_Baker shop.
 
virtual void VisitVegetableGrocer (Visitor_VegetableGrocer shop)
 Let the visitor visit a Visitor_VegetableGrocer shop.
 
virtual void VisitCondimentGrocer (Visitor_CondimentGrocer shop)
 Let the visitor visit a Visitor_CondimentGrocer shop.
 
virtual void VisitPickleGrocer (Visitor_PickleGrocer shop)
 Let the visitor visit a Visitor_PickleGrocer shop.
 
virtual void VisitMaker (Visitor_Maker shop)
 Let the visitor visit a Visitor_Maker shop.
 

Detailed Description

All visitors must implement this base class and then override one or more of the VisitXXX() methods, depending on which shop type the visitor class is interested in.

For every new shop class added, a new VisitXXX() method needs to be added to this base class and then all visitor classes must be rebuilt. There is no way around this as the Visitor_Shop and Visitor classes are closely intertwined – at least at the interface level.

Definition at line 25 of file Visitor_Element_Classes.cs.

Member Function Documentation

◆ VisitBaker()

virtual void VisitBaker ( Visitor_Baker  shop)
inlinevirtual

Let the visitor visit a Visitor_Baker shop.

Parameters
shopThe specific baker shop being visited.

Reimplemented in OrderVisitor.

Definition at line 43 of file Visitor_Element_Classes.cs.

Referenced by Visitor_Baker.Accept().

◆ VisitButcher()

virtual void VisitButcher ( Visitor_Butcher  shop)
inlinevirtual

Let the visitor visit a Visitor_Butcher shop.

Parameters
shopThe specific butcher shop being visited.

Reimplemented in OrderVisitor.

Definition at line 37 of file Visitor_Element_Classes.cs.

Referenced by Visitor_Butcher.Accept().

◆ VisitCondimentGrocer()

virtual void VisitCondimentGrocer ( Visitor_CondimentGrocer  shop)
inlinevirtual

Let the visitor visit a Visitor_CondimentGrocer shop.

Parameters
shopThe specific condiment grocer being visited.

Reimplemented in OrderVisitor.

Definition at line 55 of file Visitor_Element_Classes.cs.

Referenced by Visitor_CondimentGrocer.Accept().

◆ VisitMaker()

virtual void VisitMaker ( Visitor_Maker  shop)
inlinevirtual

Let the visitor visit a Visitor_Maker shop.

Parameters
shopThe specific maker shop being visited.

Reimplemented in OrderVisitor.

Definition at line 67 of file Visitor_Element_Classes.cs.

Referenced by Visitor_Maker.Accept().

◆ VisitPickleGrocer()

virtual void VisitPickleGrocer ( Visitor_PickleGrocer  shop)
inlinevirtual

Let the visitor visit a Visitor_PickleGrocer shop.

Parameters
shopThe specific pickle grocer being visited.

Reimplemented in OrderVisitor.

Definition at line 61 of file Visitor_Element_Classes.cs.

Referenced by Visitor_PickleGrocer.Accept().

◆ VisitRestaurant()

virtual void VisitRestaurant ( Visitor_Restaurant  shop)
inlinevirtual

Let the visitor visit a Visitor_Restaurant shop.

Parameters
shopThe specific restaurant being visited.

Reimplemented in OrderVisitor.

Definition at line 31 of file Visitor_Element_Classes.cs.

Referenced by Visitor_Restaurant.Accept().

◆ VisitVegetableGrocer()

virtual void VisitVegetableGrocer ( Visitor_VegetableGrocer  shop)
inlinevirtual

Let the visitor visit a Visitor_VegetableGrocer shop.

Parameters
shopThe specific vegetable grocer being visited.

Reimplemented in OrderVisitor.

Definition at line 49 of file Visitor_Element_Classes.cs.

Referenced by Visitor_VegetableGrocer.Accept().


The documentation for this class was generated from the following file: