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

Represent a vegetable grocer. More...

Inheritance diagram for Visitor_VegetableGrocer:
Inheritance graph
Collaboration diagram for Visitor_VegetableGrocer:
Collaboration graph

Public Member Functions

override void Accept (Visitor visitor)
 Handle visitors to this class.
 
- Public Member Functions inherited from Visitor_Shop
bool PlaceOrder (string[] items)
 Place an order for the specified items. If the inventory is empty, replenish the inventory by visiting other shops for the missing ingredients.
 
void PickupOrder (string[] items, List< string > itemsToBePickedUp)
 Pick up the items sold by this shop (assumes the items were ordered already). Basically, this reduces the inventory for the given items that are sold by this shop.
 
abstract void Accept (Visitor visitor)
 The visitor will call this method on each element it wants to visit.
 

Additional Inherited Members

- Public Attributes inherited from Visitor_Shop
string Name = string.Empty
 Name of the shop.
 
string Address = string.Empty
 Address of the shop (could be a structure but a simple string is sufficient for this example).
 
Village Village = new Village()
 The Village that contains this shop.
 
Dictionary< string, string[]> IngredientsForItems = new Dictionary<string, string[]>()
 Specifies the ingredients needed for each item sold by the shop. Also, the keys are what the shop sells. The ingredient list could be empty if this shop is the origin of the item used as the key.
 

Detailed Description

Represent a vegetable grocer.

Definition at line 395 of file Visitor_Element_Classes.cs.

Member Function Documentation

◆ Accept()

override void Accept ( Visitor  visitor)
inlinevirtual

Handle visitors to this class.

Parameters
visitorThe visitor

Implements Visitor_Shop.

Definition at line 401 of file Visitor_Element_Classes.cs.

References Visitor.VisitVegetableGrocer().


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