35 Console.WriteLine(
"Visitor Exercise");
37 Console.WriteLine(
" Creating Village");
42 Console.WriteLine(
" Ordering a hamburger from a shop in the {0}", village.
Name);
50 Console.WriteLine(
" We received a {0} from {1}.",
55 Console.WriteLine(
" Failed to receive a hamburger");
58 Console.WriteLine(
" Done.");
A visitor used for ordering items from various shops. The user starts with an instance of this class ...
List< string > ItemsReceived
List of items received from an order/pickup process.
string ShopNameReceivedFrom
Name of the shop that provided the item(s).
Represents a collection of shops that can be visited.
void LoadVillage()
Load the village.
string Name
Name of this village.
void Accept(Visitor visitor)
The visitor will call this method on each element it wants to visit.
Example of using the Visitor Pattern in C#.
void Run()
Executes the example for the Visitor Pattern in C#.
The namespace containing all Design Pattern Examples implemented in C#.