Skip to content

Instantly share code, notes, and snippets.

@cch12313
Last active October 17, 2021 02:59
Show Gist options
  • Save cch12313/6e46eb034e7a7b178fd6728664a12989 to your computer and use it in GitHub Desktop.
Save cch12313/6e46eb034e7a7b178fd6728664a12989 to your computer and use it in GitHub Desktop.
Strategy Pattern
using System;
namespace design_pattern
{
class Program
{
static void Main(string[] args)
{
Toyote car1 = new Toyote();
Bens car2 = new Bens();
Tezla car3 = new Tezla();
car1.Skill();
car2.Skill();
car3.Skill();
}
}
public class Toyote
{
public void Skill()
{
Console.WriteLine("噴射加速~");
}
}
public class Bens
{
public void Skill()
{
Console.WriteLine("噴射加速~");
}
}
public class Tezla
{
public void Skill()
{
Console.WriteLine($"噴射加速~");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment