Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created May 24, 2022 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/815c2df405580fc6f4d8e6d930c60000 to your computer and use it in GitHub Desktop.
Save lgolubyev/815c2df405580fc6f4d8e6d930c60000 to your computer and use it in GitHub Desktop.
public interface IEmployee
{
void Work();
}
public class Human : IEmployee
{
public void Work()
{
// ....working
}
}
public class Robot : IEmployee
{
public void Work()
{
//.... working much more
}
}
public class Manager
{
private readonly IEnumerable<IEmployee> _employees;
public Manager(IEnumerable<IEmployee> employees)
{
_employees = employees;
}
public void Manage()
{
foreach (var employee in _employees)
{
_employee.Work();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment