Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b1b23ac

Browse files
[Abstract factory] - extract classes to files.
1 parent a0a61a0 commit b1b23ac

25 files changed

+558
-319
lines changed

‎Abstract Factory/Abstract Factory.csproj‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,32 @@
4242
<Reference Include="System.Xml" />
4343
</ItemGroup>
4444
<ItemGroup>
45-
<Compile Include="Program.Structural.cs" />
45+
<Compile Include="Read world code\Continent\AfricaFactory.cs" />
46+
<Compile Include="Read world code\Continent\AmericaFactory.cs" />
47+
<Compile Include="Read world code\Animals\AnimalWorld.cs" />
48+
<Compile Include="Read world code\Animals\Bison.cs" />
49+
<Compile Include="Read world code\Animals\Carnivore.cs" />
50+
<Compile Include="Read world code\Continent\ContinentFactory.cs" />
51+
<Compile Include="Read world code\Animals\Herbivore.cs" />
52+
<Compile Include="Read world code\Animals\Lion.cs" />
53+
<Compile Include="Structural codes\AbstractFactory.cs" />
54+
<Compile Include="Structural codes\AbstractProductA.cs" />
55+
<Compile Include="Structural codes\AbstractProductB.cs" />
56+
<Compile Include="Structural codes\Client.cs" />
57+
<Compile Include="Structural codes\ConcreteFactory1.cs" />
58+
<Compile Include="Structural codes\ConcreteFactory2.cs" />
59+
<Compile Include="Structural codes\Products\ProductA1.cs" />
60+
<Compile Include="Structural codes\Products\ProductA2.cs" />
61+
<Compile Include="Structural codes\Products\ProductB1.cs" />
62+
<Compile Include="Structural codes\Products\ProductB2.cs" />
63+
<Compile Include="Structural codes\Program.Structural.cs" />
4664
<Compile Include="Properties\AssemblyInfo.cs" />
65+
<Compile Include="Read world code\Animals\Wildebeest.cs" />
66+
<Compile Include="Read world code\Animals\Wolf.cs" />
4767
</ItemGroup>
4868
<ItemGroup>
4969
<None Include="App.config" />
50-
<Compile Include="Program.RealWorldCode.cs" />
70+
<Compile Include="Read world code\Program.RealWorldCode.cs" />
5171
</ItemGroup>
5272
<ItemGroup>
5373
<Content Include="Participants.txt" />

‎Abstract Factory/Program.RealWorldCode.cs‎

Lines changed: 0 additions & 160 deletions
This file was deleted.

‎Abstract Factory/Program.Structural.cs‎

Lines changed: 0 additions & 157 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/// <summary>
2+
/// Creates an instance of several families of classes.
3+
///
4+
/// Provide an interface for creating families of related or
5+
/// dependent objects without specifying their concrete classes.
6+
///
7+
/// Frequence of use: 5 high.
8+
/// </summary>
9+
namespace DoFactory.GangOfFour.Abstract.RealWorld
10+
{
11+
/// <summary>
12+
/// The 'Client' class
13+
/// </summary>
14+
class AnimalWorld
15+
{
16+
private Herbivore _herbivore;
17+
private Carnivore _carnivore;
18+
19+
// Constructor
20+
public AnimalWorld(ContinentFactory factory)
21+
{
22+
_carnivore = factory.CreateCarnivore();
23+
_herbivore = factory.CreateHerbivore();
24+
}
25+
26+
public void RunFoodChain()
27+
{
28+
_carnivore.Eat(_herbivore);
29+
}
30+
}
31+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /