Skip to content

Commit

Permalink
Prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCancio committed Jan 13, 2021
1 parent 1f4abe4 commit 3fa1152
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
6 changes: 6 additions & 0 deletions PatternsCriacao/PatternsCriacao.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractFactory", "Abstract
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Builder\Builder.csproj", "{F6EE8C26-9785-4A05-A079-9E453345FF0E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prototype", "Prototype\Prototype.csproj", "{B74BC4EE-0C43-443D-B6AA-3D4B5E43A2F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,6 +35,10 @@ Global
{F6EE8C26-9785-4A05-A079-9E453345FF0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6EE8C26-9785-4A05-A079-9E453345FF0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6EE8C26-9785-4A05-A079-9E453345FF0E}.Release|Any CPU.Build.0 = Release|Any CPU
{B74BC4EE-0C43-443D-B6AA-3D4B5E43A2F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B74BC4EE-0C43-443D-B6AA-3D4B5E43A2F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B74BC4EE-0C43-443D-B6AA-3D4B5E43A2F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B74BC4EE-0C43-443D-B6AA-3D4B5E43A2F8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
15 changes: 15 additions & 0 deletions PatternsCriacao/Prototype/FuncionarioPermanente.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace Prototype
{
public class FuncionarioPermanente : IFuncionario
{
public string Nome { get; set; }
public int Idade { get; set; }
public string Tipo { get; set; }
public IFuncionario Clone()
{
return this.MemberwiseClone() as IFuncionario;
}
}
}
17 changes: 17 additions & 0 deletions PatternsCriacao/Prototype/FuncionarioTemporario.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Prototype
{
public class FuncionarioTemporario : IFuncionario
{
public string Nome { get; set; }
public int Idade { get; set; }
public string Tipo { get; set; }
public IFuncionario Clone()
{
return this.MemberwiseClone() as IFuncionario;
}
}
}
9 changes: 9 additions & 0 deletions PatternsCriacao/Prototype/IFuncionario.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace Prototype
{
public interface IFuncionario
{
IFuncionario Clone();
}
}
27 changes: 27 additions & 0 deletions PatternsCriacao/Prototype/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;

namespace Prototype
{
class Program
{
static void Main(string[] args)
{
FuncionarioPermanente func_permanente = new FuncionarioPermanente
{
Nome = "João",
Idade = 30,
Tipo = "Permanente"
};

FuncionarioPermanente clone_func_permanente = (FuncionarioPermanente)func_permanente.Clone();
clone_func_permanente.Nome = "Carlos";
clone_func_permanente.Idade = 40;

Console.WriteLine("Detalhes do funcionário Permanente:");
Console.WriteLine($"Nome: {func_permanente.Nome} \nIdade: {func_permanente.Idade} \nTipo: {func_permanente.Tipo}");

Console.WriteLine("\nDetalhes do funcionário Permanente Clonado:");
Console.WriteLine($"Nome: {clone_func_permanente.Nome} \nIdade: {clone_func_permanente.Idade} \nTipo: {clone_func_permanente.Tipo}");
}
}
}
8 changes: 8 additions & 0 deletions PatternsCriacao/Prototype/Prototype.csproj
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>

0 comments on commit 3fa1152

Please sign in to comment.