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 b7b15ba

Browse files
ADD image
1 parent 63b46bd commit b7b15ba

File tree

6 files changed

+13
-3
lines changed

6 files changed

+13
-3
lines changed

‎Src/Creational/FactoryMethod/Car/Ferrari.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ public string GetPrice()
66
{
77
return "Base Ferrari Price: 252,800ドル";
88
}
9+
10+
public override string ToString()
11+
{
12+
return "Type: Ferrari";
13+
}
914
}
1015
}

‎Src/Creational/FactoryMethod/Car/Ford.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ public string GetPrice()
66
{
77
return "2020 MUSTANG Starting at 35,630ドル";
88
}
9+
10+
public override string ToString()
11+
{
12+
return "Type: Ford";
13+
}
914
}
1015
}

‎Src/Creational/FactoryMethod/Factory/CarFactory.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace FactoryMethod.Factory
66
{
7-
public class CarFactory
7+
public abstractclass CarFactory
88
{
99
public static ICar Car(CarsBrand carsBrand)
1010
{

‎Src/Creational/FactoryMethod/Program.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ class Program
99
static void Main(string[] args)
1010
{
1111
ICar ferrari = CarFactory.Car(CarsBrand.Ferrari);
12-
Console.WriteLine(ferrari.GetPrice());
12+
Console.WriteLine(ferrari.ToString());
1313

1414
ICar ford = CarFactory.Car(CarsBrand.Ford);
15-
Console.WriteLine(ford.GetPrice());
15+
Console.WriteLine(ford.ToString());
1616

1717
Console.ReadKey();
1818

‎img/Design Patterns.jpg‎

70.5 KB
Loading[フレーム]

‎img/ddd.jpg‎

-95.4 KB
Binary file not shown.

0 commit comments

Comments
(0)

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