forked from danieldantasdev/DesignPatternsInUse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
17 lines (13 loc) · 786 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* This example demonstrates how the Builder pattern can be used to construct complex objects.
* By changing the builder, you can produce different representations of the object
* (in this case, different types of computers) using the same construction process. */
IComputerBuilder gamingBuilder = new GamingComputerBuilder();
ComputerDirector director = new ComputerDirector(gamingBuilder);
director.ConstructComputer();
Computer gamingComputer = director.GetComputer();
Console.WriteLine("Gaming Computer: " + gamingComputer);
IComputerBuilder officeBuilder = new OfficeComputerBuilder();
director = new ComputerDirector(officeBuilder);
director.ConstructComputer();
Computer officeComputer = director.GetComputer();
Console.WriteLine("Office Computer: " + officeComputer);