-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
30 lines (25 loc) · 1.28 KB
/
Program.cs
File metadata and controls
30 lines (25 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
namespace PrototypePattern2
{
class Program
{
static void Main(string[] args)
{
SandwichMenu sandwichMenu = new SandwichMenu();
// Initialize with default sandwiches
sandwichMenu["BLT"] = new Sandwich("Wheat", "Bacon", "", "Lettuce, Tomato");
sandwichMenu["PB&J"] = new Sandwich("White", "", "", "Peanut Butter, Jelly");
sandwichMenu["Turkey"] = new Sandwich("Rye", "Turkey", "Swiss", "Lettuce, Onion, Tomato");
// Deli manager adds custom sandwiches
sandwichMenu["LoadedBLT"] = new Sandwich("Wheat", "Turkey, Bacon", "American", "Lettuce, Tomato, Onion, Olives");
sandwichMenu["ThreeMeatCombo"] = new Sandwich("Rye", "Turkey, Ham, Salami", "Provolone", "Lettuce, Onion");
sandwichMenu["Vegetarian"] = new Sandwich("Wheat", "", "", "Lettuce, Onion, Tomato, Olives, Spinach");
// Now we can clone these sandwiches
Sandwich sandwich1 = sandwichMenu["BLT"].Clone() as Sandwich;
Sandwich sandwich2 = sandwichMenu["ThreeMeatCombo"].Clone() as Sandwich;
Sandwich sandwich3 = sandwichMenu["Vegetarian"].Clone() as Sandwich;
// Wait for user
Console.ReadKey();
}
}
}