Bardzo prosty w konstrukcji. Wystarczy stworzyć interfejs z jedną metodą.
Cel: wywoływanie akcji z różnych klas
public interface ICommand
{
void Execute();
}
public class Command1 : ICommand
{
privatebool executed = false;
public void Execute()
{
executed = true;
}
}
public class Command2 : ICommand
{
private bool executed = false;
public void Execute()
{
executed = true;
}
}