forked from exceptionnotfound/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
33 lines (28 loc) · 1.25 KB
/
Copy pathProgram.cs
File metadata and controls
33 lines (28 loc) · 1.25 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
31
32
33
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Prototype
{
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 the sandwiches.
Sandwich sandwich1 = sandwichMenu["BLT"].Clone() as Sandwich;
Sandwich sandwich2 = sandwichMenu["ThreeMeatCombo"].Clone() as Sandwich;
Sandwich sandwich3 = sandwichMenu["Vegetarian"].Clone() as Sandwich;
Console.ReadKey();
}
}
}