forked from LucasCancio/design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69cb37c
commit 22d4c26
Showing
6 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace TemplateMethod | ||
{ | ||
public abstract class AbstractClass | ||
{ | ||
public abstract void PrimitveOperation1(); | ||
|
||
public abstract void PrimitveOperation2(); | ||
|
||
public void TemplateMethod() | ||
{ | ||
PrimitveOperation1(); | ||
PrimitveOperation2(); | ||
Console.WriteLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace TemplateMethod | ||
{ | ||
public class ConcreteClassA : AbstractClass | ||
{ | ||
public override void PrimitveOperation1() | ||
{ | ||
Console.WriteLine("ConcreteClassA.PrimitveOperation1()"); | ||
} | ||
|
||
public override void PrimitveOperation2() | ||
{ | ||
Console.WriteLine("ConcreteClassA.PrimitveOperation2()"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace TemplateMethod | ||
{ | ||
public class ConcreteClassB : AbstractClass | ||
{ | ||
public override void PrimitveOperation1() | ||
{ | ||
Console.WriteLine("ConcreteClassB.PrimitveOperation1()"); | ||
} | ||
|
||
public override void PrimitveOperation2() | ||
{ | ||
Console.WriteLine("ConcreteClassB.PrimitveOperation2()"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace TemplateMethod | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
AbstractClass abstrata_a = new ConcreteClassA(); | ||
|
||
abstrata_a.TemplateMethod(); | ||
|
||
AbstractClass abstrata_b = new ConcreteClassB(); | ||
|
||
abstrata_b.TemplateMethod(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |