forked from josuecorrea/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
29 lines (26 loc) · 768 Bytes
/
Copy pathProgram.cs
File metadata and controls
29 lines (26 loc) · 768 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FactoryMethod
{
class Program
{
static void Main(string[] args)
{
List<Sandwich> sandwiches = new List<Sandwich>();
sandwiches.Add(new TurkeySandwich());
sandwiches.Add(new Dagwood());
foreach(var sandwich in sandwiches)
{
Console.WriteLine("\nSandwich: " + sandwich.GetType().Name + " ");
foreach(var ingredient in sandwich.Ingredients)
{
Console.WriteLine("Ingredient: " + ingredient.GetType().Name);
}
}
Console.ReadKey();
}
}
}